Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

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.

namespace akioma.osiv.stamm {
 
    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);
        }
    }
 
}

Open a “Versicherte” like “Zukerhuat Terence” , open designer in external screen and add “$ akioma.osiv.stamm.TestEventOnStateChanged(eventSource);” for an input, the form, first tab and sidebar item and for the window.

Now if you change something in the form, or remove the value form a mandatory field (or set a customState in future) you will see the coresponding console.logs.



  • No labels