Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

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
Employee
Employee

Re: How to clear other selections with the Field API?

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

Re: How to clear other selections with the Field API?

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.

Employee
Employee

Re: How to clear other selections with the Field API?

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...

Community Browser