Okay
  Public Ticket #2733184
Filter by Not Blank
Closed

Comments

  • Justin Gesso started the conversation

    Hello, I have a large table and want to show a subset of rows where cells in a specific column are not blank.

    So in that column, if a cell is blank, I don't want to show that row.

    This seems to be a good use case for the Filter feature, however, I'm not sure what method to use for showing only non-blanks. I can filter by specific values, but really want any value as long as it's not empty.

    Also, the values may change, so it won't work to just preselect everything currently in that column.

    Can you please assist?

  •  2,521
    Aleksandar replied

    Hello Justin

    Unfortunately, there's no function in the plugin that would allow you to exclude empty values from the table. At the moment, there are two approaches:

    1. If you create an SQL Query based table, you can filter that through the query, adding a condition like "NOT NULL" or something similar.

    2. For a table which is not based on an SQL query, you can use conditional formatting, and add a rule to a column, so if there's an empty value (blank value), it will add a custom CSS class to the row (for example "hide"). If you add the "hide" class to the column like this, the plugin will hide the rows from front-end, but since they still are present on the page, you will see the table with empty rows. For example, if you are displaying 10 rows per page, and you have 9 rows where there's no entry in that column, on the first page you will see only 1 entry, because those 9 rows will be hidden with that CSS.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables