Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

eventOnStateChanged can be added to form fields, container and panel level objects and it responds to state changes like hasChanges, hasErrors (and customStates in a future version).

The event is returning the object that has the changes and in case of a tab(sidebar-item), it’s returning the tabbar(sidebar). Besides that, you can also check the stateData from the object. StateData contains the state, value and action just like in the table below:

PropertyValue
State

the name of the state (eg hasChanges, hasErrors)

Value

the value of the state (eg true/false)

Action

the action is null (in a future version this will be used to specify if the state value was set or cleared (eg set/clear)


Example:

Create a new typescript file for example “TestEventOnStateChanged.ts” and add the following code for testing.

Code Block
namespace akioma.abc.efg {
 
    export function TestEventOnStateChanged(object: any) {
        if (object.type == 'tabbar') {
            object = object.fetchPage(object.currentPageNum);
        } 
        if (object.stateData && Object.keys(object.stateData).length !== 0) {
            console.log('The object and stateData', object, object.stateData);
        }
    }
 
}