Okay
  Public Ticket #2850840
delete a cell/row when empty
Closed

Comments

  •  1
    Edwin Dee started the conversation

    Hello

    I have a table synced with Google Sheets. The default table has 1000 rows but the rows with data vary over time, sometimes it has 200 rows with data and sometimes 500 rows, and sometimes more or less. Never exactly 1000 rows with data.

    What I want to do is to delete or remove the empty rows automatically after the data is fetched from Google Sheet API. How to do this?

    I tried to do this with conditional formatting for the columns but failed. I have the possibility of giving a standard value to empty cells/rows/columns in Google Sheets if empty, for example, the value "empty". How can I tell your plugin to remove the cell/row if the value is "empty"? This is an example solution, please enlighten me if there is another better solution for this. Thanks.

  • [deleted] replied

    Hi Edwin

    Thank you for reaching out to us.

    You should be able to achieve this using conditional formatting by adding a simple rule like this

    8387089190.png


    This class should work automatically, hiding the rows that are empty, but if it doesn't work straight away, you can go to wpDataTables settings/Custom JS and CSS/Custom CSS field, and add this:

    table.wpDataTable .hide { display: none !important; }

    Please note, though, that on pages where you have rows affected by this condition, they will only be hidden from view, but they will still be present on the page. So, if you have 10 rows on the first page of the table, and there are 9 hidden rows, you will only see 1 row on the first page.

    If you have a lot of these entries, you may want to consider increasing the number of rows that exist on the page. If the table exceeds 2.000 rows, choosing the option "All" is not recommended, because the page loading time will increase, and it can also break due to the amount of data.