Change show default filter

We would like to configure which filters are exposed and/or in which order filters are exposed to the user. Is that already possible or can you add this option to make the filter panel somehow customisable?

Filter configuration is part of the layout, so you can control it by applying the whole layout. Alternatively, you can easily do it by setting the ‘columnNames’ property, just like that (you can run this code):

let view = grok.shell.addTableView(grok.data.demo.demog());
view.filters({columnNames: ['age']});
1 Like

Your code snippet works great however the order shown in the filter panel is still different from what was specified in the columNames option. Is there a way to configure the order in which the filter options are added to the filter panel?

@andreas.gasser.novartis.com This workaround is not perfect (we will definitely improve the way it’s done in the future):

  1. Save the layout of a view with the open filter panel (View | Layout | Download or programmatically via grok.shell.v.saveLayout().toJson(), see details here)

  2. In JSON, find the filter panel in the “viewStateMap” and set the order of columns in this field:

    "look": {
      "columnNames": [ "AGE", "DIS_POP", "RACE", "STARTED"]
     },
    
  3. Apply the layout (if you downloaded it from UI, simply drag-and-drop the modified file back to the view)

The order of columns should be exactly the same, at least it worked for me :slightly_smiling_face: