Deactivate a model's filterable conditions using Javascript

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.

Still wondering on this one. Any thoughts? Thx.

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>

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

Yep, works like a charm. Thanks.