I have a table with a text column. I wanted to support more complex filters such as “(A and B) OR (B and (not C OR D))”. I implemented that in the backend. Unfortunately, the DataTable seems to apply some type of syntax validation on search terms, and just changes the background color to rd and doesn’t send the query via the callback to my search implementation that correctly breaks down the expression to a series of pandas filters.
How can I disable the frontend filter?
thanks a lot!
Welcome to the community!
Have you taken a look at AG Grid? This is a feature that they have built in.
Thank you, I wasn’t really aware of AG Grid, I appreciate the pointer. But I think for right now, I’d love to just disable the filter validation rather than refactoring all DataTable functionality I implemented to work with AG Grid.
Any ideas where to look to diable the syntax validation for the search/filter fields in the table?
I’m assuming that you are using
Yes, exactly. filter_action=“custom” and then I take the query string, get the value for the freetext field I’m interested in, and parse it using pyparsing, and apply the operations to the dataframe. Just some valid formulas you can build with AND OR NOT and paranthesis won’t validate and won’t trigger the callback at all.
Are you getting any console errors with trying to create your string?
No errors, and the callback doing the filtering doesn’t seem triggered. He’s a valid expression that gets processed correctly:
Here’s one where the cell background goes red, and the callback isn’t triggered. Like, the filter function is never called, my custom expression parser doesn’t even get a chance to break down this expression:
I really want to pass through this expression to my parser, even if it’s not a valid filter_action=“native” expression, because it’s a valid “custom” expression for me.
What happens if you change your syntax to use brackets?
You could also escape out by using
\) but the syntax is not as fun.
Love that solution, that seems to add the least friction to it. Much appreciated, I didn’t think of that at all.