Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear community,
I'm trying to make use of the Selection API and retrieve all applied selections on every field in an array. By means of the selectionState() method I was able to get the selections array through:
selState = app.selectionState();
console.log(selState.selections);
The result in the console is as follows:
Now, when I try to access the first element of the array with selState.selections[0] I'm getting an "undefined" error. Hence, I'm wondering how else I can access the particular elements of that selection array. Can it be that there are certain getter methods for this type of array/object?
Thanks,
Juergen
Hi,
this is a timing problem. When you call the selectionState() method you will get an object back and the API will request the data from the QIX engine. It will also keep the selectionstate up to date. To be notified when the selections are available use the onData listener, as described here:
That fact that it looks OK in the console is because the console checks the state of the object when you expandit, not when the message is printed.
Hi,
this is a timing problem. When you call the selectionState() method you will get an object back and the API will request the data from the QIX engine. It will also keep the selectionstate up to date. To be notified when the selections are available use the onData listener, as described here:
That fact that it looks OK in the console is because the console checks the state of the object when you expandit, not when the message is printed.