Options
All
  • Public
  • Public/Protected
  • All
Menu

An interface class of a component which has data or can bind data with. All classes implementing this interface must provide the data mechanism to the user. A single data parent may have one or more data children. When parent's data is changed, the parent will propogate the data change to all of its children. The method isDataDirty provides you the way to check that the data has been edited from its original state or not. This mechanism is very useful when you're developing an application which allows the user to edit data before save. When the user is leaving the page with unsaved data, the application may notify a warning message asking the user to save the data before leaving. Imagine that if your page contains a numerous of input components, by using the data mechanism provided by this interface, you can easily register those input components as page's data children. And, when you want to check that the user can leave this page or not, you just use the method isDataDirty on page component, it will automatically check the data dirty state on all of its data children.

author

shiorin, tee4cute

see

AbstractHasData

Hierarchy

Implemented by

Index

Methods

addDataChild

  • Add a data child into this component.

    Parameters

    • child: IHasData

      A data child component to be added.

    Returns void

getData

  • getData(): any
  • Get the data object bound to this component.

    Returns any

getDataChildren

  • Get the array of data children of this component. This method will return empty array if there is no any data child of this component.

    Returns IHasData[]

getDataParent

  • Get the data parent of this component. This method can return null if this component has no data parent.

    Returns IHasData

isDataDirty

  • isDataDirty(): boolean
  • To check that the data bound to this component is dirty or not. The data will be marked as dirty if it is changed from its original state.

    Returns boolean

isIgnoreParentData

  • isIgnoreParentData(): boolean
  • To check that this component will ignore data propagated from data parent or not.

    Returns boolean

removeDataChild

  • removeDataChild(child: IHasData): void
  • Remove the given data child from this component.

    Parameters

    • child: IHasData

      A data child component to be removed.

    Returns void

resetData

  • resetData(): void
  • To reset data that bound to this component.

    Returns void

saveData

  • saveData(data?: any): void
  • To save data that bound to this component.

    Parameters

    • Optional data: any

    Returns void

setData

  • setData(data: any): void
  • Set and bind data into this component.

    Parameters

    • data: any

      The data object to set.

    Returns void

setDataParent

  • Set a data parent into this component.

    Parameters

    • parent: IHasData

      A data parent component to be set.

    Returns void

setIgnoreParentData

  • setIgnoreParentData(ignore: boolean): void
  • Set a flag indicating that this component will ignore data propagated from data parent or not.

    Parameters

    • ignore: boolean

      A flag indicating that this component will ignore data propagated from data parent or not.

    Returns void

Generated using TypeDoc