getState
returns the reactive state object of Query
object getState();
Example
// returns the current state of Query
const state = $$("query").getState();
Related samples
Details
The returned state object contains the following properties and methods:
{
value: {
glue: "or",
rules: [{ /*contains fields and values*/ },...]
}
}
Properties
- value (object) - stores all the rules and logic for filtering.
Methods
- $observe (function) - a handler to listen to changes in the current state of Query. It takes 2 parameters:
- prop (string) - a reactive property to listen changes of
- handler (function) - a function to execute when changes are made. It takes the only argument:
- value (object) - the current value of the reactive property.
For example, you can listen to the value changes as:
$$("query").getState().$observe("value", v => {
$$("log").setValue(JSON.stringify(v, "", "\t"));
});
See also
Back to top
Join Our Forum
We've retired comments here. Visit our forum for faster technical support,
connect with other developers, and share your feedback there.