ui.query filter for empty string

I am trying to add custom filters to text fields using a form with ui.query. I have added "notEmpty" and "empty" or "isEmpty". I tried various names for the "empty" filter, in case "empty" turned out to be a reserved word.

This snippet shows that when I apply the same filter formula to empty and notEmpty, only changing !== to ==, only notEmpty works.

In fact ... I also discovered that I could pass my values to a separate function and created a separate snippet which does that. The second snippet uses console.log to report the values it receives. It turns out that no blank/empty/null values are even passed. It seems like they are pre-filtered.

Would somebody please take a look and advise me how I might correct this issue in a way that permits my users to filter for blank values in their datatables using the ui.query GUI with my form?

Comments

  • Based on other threads found in this forum, it appears that you cannot filter for empty strings. That seems to be used to clear filter selections.

    So, instead, I am altering empty values with MySQL to return  . This is HTML code for a blank space. Then, I modified my filters to search for that HTML code, instead of an empty string.

    You can see my modifications in this new snippet. Look for the inline comments to see what I modified and how.

    Hope this helps somebody!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion