Best way to remove filtered rows?

Tags: #<Tag:0x00007f8b1d456320> #<Tag:0x00007f8b1d4561e0>

I have a file list where a file can correspond to one or more rows in a table. Sometimes rows regarding a specific file can be filtered out and if the file is removed I want to remove all rows regarding the file, even if they are filtered out.

How can I achieve this?

My experience is that if the table is filtered it’s only the visible rows that are affected by hot.alter(“remove_row”, series), and I have to remove any filters to be able to remove the correct rows.

I would prefer to be able to do this without clearing the filters first, so the user doesn’t have to re-apply the filters.

Hi @mottosson

Because of how the data management is designed in Handsontable it’s not possible to remove filtered rows or columns, as CRUD operations are performed on the visual indexes, and if the row is currently not visible (filtered) it can’t be removed.

Would this be relevant to feature request? It would be very convenient to be able to work with invisible rows.

Is there a way to copy the filters, clear them, remove rows, then re-apply in a hot.batch to make it instant?

@mottosson

Of course, feel free to create a feature request, I think we should consider modifying this behavior.

And yes, you can batch such operations using internal methods of the Filters plugin: https://handsontable.com/docs/javascript-data-grid/api/filters/#methods

Where can I see all the filters applied to my table?

Is it possible to just clone the filter object, clear the current, then re-apply the clone?

@mottosson

You can use afterFilter hook to get the information about applied filters: https://handsontable.com/docs/javascript-data-grid/api/hooks/#afterfilter

Unfortunately it has to be re-applied condition by condition.

Ok, I’ll try that. Thanks!