I have a table that the data is bound to a query. I have a few questions that I don’t know if are even possible:
Is it possible to create my own “filter” using a text entry field? If I use the built-in filter option on the table and then say I have another text entry field that the user can add more data to filter the table by? Is it possible to have these two “filters” work together?
Is it possible to filter the table using data from a column that is set to be “hidden”?
Thank you in advance
I don’t have the solution to this question, but it’s something I wondered for a while… The filtering options for the Perspective Table component are lackluster, to put it mildly. It’s also a component that I would imagine is heavily used in higher level applications (MES, psuedo-ERP, etc).
One thing I’ve done in the past is to enable filtering on the table, use the CSS injection trick to hide the default filter bar at the top of the table, and then bind the table’s filter text property to my own custom text field. This helps with making the table look prettier but it doesn’t add anything functionally…
It isn’t possible to filter on more than one column. What would be neat is to build out filters using text fields and other components and then OR or AND them together (on more than one column). But afaik this isn’t possible, sadly.
Regarding your last point, you can filter when a column is not visible. Again, the same limitations I explained above apply (that you can only filter on one column). The steps to accomplish this are to add your table’s column objects and name the columns properly. At this point, if you uncheck the visible checkbox on a column, you won’t be able filter on that column. The trick is to keep visible turned on, but to also set
true and the
width to 0.
Thanks for the tip, that is working. I wish there was a way to add more filter options…
Not possible with the Table components filter prop but you can always create a custom prop where the unfiltered dataset is held, and then based on filtering options you provide filter the data in a script transform on the binding.
It’s a little more work, but it is possible.
I should’ve been more clear - I was trying say that it isn’t possible with the Table component, not that filtering isn’t possible at all. One could take the approach you described, or filter using the database query (pass parameters to named query), or some other approach… It just feels clunky doing it that way - the Vision Power Table had amazing filtering capabilities.
Would you mind expanding on this a little more? What would this look like?
Instead of binding the table’s
data prop to whatever fills the table, bind that to a custom binding instead.
Now, you can add a form to your view (text fields, numeric fields, etc.) and use the values entered there to filter the dataset, then use the result as the table’s
You actually don’t need a custom prop for this, using a structure binding on your
props.data is usually enough.