Skip to main content

getState()

gets current values/states of controls

getState(id?: Id): IState;

Parameters:

id: string | number - optional, the id of a Toolbar control

Returns:

Either a string with the value of the control, or a boolean value with the state of the control, or an object with IDs of controls and their values/states.

Example

var state1 = toolbar.getState("search"); // -> "toolbar"
var state2 = toolbar.getState(); // -> {"search":"toolbar","edit":true,"align":"right"}

Related sample: Toolbar. Get State

Starting from v7.0, the method can return the value/state of the control by its id:

var state1 = toolbar.getState("search"); // -> "toolbar"
var state2 = toolbar.getState("edit"); // -> true/false

If id of a control is not passed to the method, the method returns an object with IDs of controls and their values/states:

var state = toolbar.getState(); // -> {"search":"toolbar","edit":true,"align":"right"}

Change log:

The ability to pass the id parameter to the method is added in v7.0.