Saving the State

While using the application, at some point you might want to update the stored state object, for example, after a filter value changes or after a search is performed. During these instances, you would not want the users to lose their work. You call the save state method on these events.

To save the state, use the following guidelines:

  • Define an object in the model that is the state object.
  • On events where the state should be updated, update the object and use the save state method to store it.

The following example shows how to define the save state method:

Example: saveState Method

this.state = 
{
   filterValue: this.filterValue()
}
            
this.saveValueState =  function(event, data, bindingContext) 
{
   if(typeof jde__saveState === 'function')
   {
      bindingContext.$data.state.filterValue = event.detail.value;            
      jde__saveState(bindingContext.$data.state);
   }
}