Skip to main content
Nintex Community Menu Bar
Question

Deactivate a model's filterable conditions using Javascript

  • July 9, 2024
  • 4 replies
  • 8 views

Forum|alt.badge.img+10

Further to this post: http://community.skuid.com/t/apply_filter_and_navigate_to_tab_using_javascript In the same function, before I set the model’s condition, I want to deactivate all other filterable conditions so that I can be sure that the user is seeing the right set of data. I know how to deactivate conditions by name (as described here: http://community.skuid.com/t/manually_triggering_filters). But we can’t know for sure at runtime how many filters there are, so this is too hard-codey. And I don’t want to deactivate all conditions for the model, just filterable ones. Is there a simple property to check perhaps? Thanks … and happy new year. May it be as huge as 2013, eh? Glenn.

This topic has been closed for replies.

4 replies

Forum|alt.badge.img+10
  • Author
  • 279 replies
  • July 9, 2024

Still wondering on this one. Any thoughts? Thx.


Forum|alt.badge.img+13

My advice would be to iterate over all Conditions in the Model, and if a Condition’s “name” property is set, then assume it’s Filterable, as only Filterable Conditions should have Names.

var $ = skuid.$; var myModel = skuid.model.getModel('Opportunities'); $.each(myModel.conditions,function(i,condition){ if (condition.name) myModel.deactivateCondition(condition); }); <br>

Forum|alt.badge.img+10
  • Author
  • 279 replies
  • July 9, 2024

Ah yes, that makes sense, and very simple. I’ll give it a try.


Forum|alt.badge.img+10
  • Author
  • 279 replies
  • July 9, 2024

Yep, works like a charm. Thanks.