Apply filter and navigate to tab using Javascript

Glenn ElliottGlenn Elliott Member
edited March 2 in Questions
I wanted to check with Team Skuidify how far into the realm of hack I'm going here. We have a page that has a grid of tiles where each tile presents an infographic-style statistic beside an associated icon. Each number is sourced from an aggregate model. An example is a stat for Number of Tasks Completed This Month, or Number of New Prospects This Month. When the user clicks the tile, they're navigated to a tab that has a table relevant to the stat and a filter is applied to return just those records that support the stat. E.g. when they click Number of Tasks Completed This Month, they go to the Tasks tab, the Completed Tasks subtab, with the table filtered to show just tasks completed this month. We have it working with a little bit of JQueryUI code that I think mimics what Skuid does when it navigates between tabs: skuid.$("#filtercompletedtasks").click(function() { //Get the model var theModel = skuid.model.getModel('CompletedTasks'); var theCondition = theModel.getConditionByName('DueDate'); //Set the condition for the tile, which will also update the filter on the table theModel.setCondition(theCondition,'THIS_MONTH'); theModel.updateData(); //Navigate to the Tasks tab, and the Completed Tasks subtab skuid.$( "#sidenavtabs" ).tabs( "option", "active", 4 ); skuid.$( "#taskssub" ).tabs( "option", "active", 1 ); }); The question is: are we doing this in the best way, or are we stepping into a no man's land of unsupported hackery?


  • Zach McElrathZach McElrath Skuad
    edited March 2
    As far as your Tab navigation mechanism, you're using the supported underlying jQuery UI API for activating ("navigating to") a Tab, so this is fine. And your use of the Conditions API is totally kosher.
  • Glenn ElliottGlenn Elliott Member
    edited April 2017
    Great! Good to know. Thanks Zach.
Sign In or Register to comment.