Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to clear other selections with the Field API?

I am using the QField object and the "select" or "selectValues" methods, but this does not clear other selections outside of the passed array, and if I call the clear() method first, I will re-trigger the the event loop.

How can I tell the field to select only the values I pass in to the method, or to clear, and then select, in a single event?

Thanks.

3 Replies
Francis_Kabinoff
Former Employee
Former Employee

Make sure "toggle" is set to false. It should be by default

app.field(<field>).selectValues( [<values>] )

but if you do

app.field(<field>).selectValues( [<values>], true )


then "toggle" is set to true and it will toggle selections, instead of the behavior you are looking for.


You can also set "toggle" to false explicitly.


app.field(<field>).selectValues( [<values>], false )

Not applicable
Author

I did have toggle set to "true".  However, I am getting a "Function not allowed on this object in app modal mode" error when I try to call selectValues(['MyValue'])?  Any ideas how to resolve this?

Thanks.

Update: I think this is because the field selection box is open, but I don't see any events other than OnData that I can attach to, and I don't see any way to determine if the "object is in app modal mode" or not inside of the method.

Francis_Kabinoff
Former Employee
Former Employee

Hmm, not entirely sure, haven't experienced the problem myself. Maybe using the selectValues method of the Extension API instead of from the Field API would solve your problem? https://help.qlik.com/en-US/sense-developer/3.1/Subsystems/APIs/Content/ExtensionAPI/selectvalues-me...