Filtering table from multiselection dropdown

(For anyone else, this is a follow up to Checkbox filter, selected box and non selected boxes - #9 by Transistor)

Here are two ways:
First, create a custom property custom.tableFilter on the view and make a bidirectional binding to it from the dropdown props.value. (This avoids all the getParent / getSibling syntax and will make your script less "brittle".)

1: Use the custom property as a parameter in the SQL query. This will automatically refresh the binding if the dropdown selection changes.
2: Use the custom property to trigger a script transform on the SQL results. Here's how I would do that:

  • On the Table component add a custom property, custom.data. Create a query binding on that so that it retrieves all the records.
  • On props.data create a property binding to view.custom.tableFilter. (Now when the dropdown selection changes this binding will refresh.)
  • Add a Script Transform to script the filter. The data will be available from self.custom.data and the filter will be passed as value into the script.

Have fun.

3 Likes