[GH-DEV #1268] Filtering with fixed columns and excluding rows

Tags: #<Tag:0x00007efc6d66d648> #<Tag:0x00007efc6d68f630>

Hello,
I’ve added the ability to filter by column in my Handsontable table but I’m getting some weird behaviour.
I have my first 6 lines which are fixed and I exlude them in the “afterFilter” hook.

However, when I search by condition or by value, I don’t get the right result.

First case: I do a search by condition for people whose name begins with ‘Ad’. I only get one result when there should be two. I’ve noticed that if I remove “filtersRowsMap.setValueAtIndex(5, false);”, then the second expected result appears but in an excluded line.


Second case: the cells in column 0 are merged and when I perform the search by value the last element contains only one row when there should be two and there is missing data as in the first case.

This is the codesandbox link to be able to replicate the problems I have if needed: https://codesandbox.io/p/sandbox/upbeat-wilbur-454wjs?file=%2Fsrc%2Findex.js

Thank you in advance for your help,

Samuel.

Hi @samuel.vancampenhout

Could you tell me a bit more about what you would like to achieve within the afterFilter? The filtersRowsMap method is private, it shouldn’t be used.

Hello,

I followed the tutorial provided by handsontable to exclude rows from a table when filtering : https://handsontable.com/docs/javascript-data-grid/column-filter/

The goal is to ignore the first 6 rows when sorting. I only want the sort to apply from the 7th row onwards

I will proceed with a code review, @samuel.vancampenhout

Private API examples are usually good if the table is not complex. When it starts to have more logic applied private API may not work well, as it is not tested against the use of other plugins, just like public API. It seems like in a simple example like this one https://stackblitz.com/edit/vitejs-vite-uun9nr?file=main.js,index.html&terminal=dev both filters (condition and value) work well with the filtersRowsMap applied. However, in your case, it doesn’t.

I will do my best to update you after the weekend.

Thanks for your help, I hope we can find a way to solve this little problem.

Have a nice weekend,

Samuel.

I am sorry for the delay, @samuel.vancampenhout
I was engaged in one quick project that I needed to finish.

I was checking some other alternatives but did not find any. I will consult our CTO and get back to you once I get any news from him.

Perfect, thank you