Search code examples
javascriptshieldui

Search by filtering really slow with a lot of registers


I'm using the shield ui grid to show aproximately 20k rows of data. I want to filter those registers using the search by filtering functionality (https://demos.shieldui.com/web/grid-general/search-by-filtering). The problem I'm encountering is that this kind of filter is really slow; but I've found out that no matter how many columns you filter by, it is equally slow. Even if I put a SetTimeout of 2 seconds, when I type the first letter of the word I want to look for in the filtering, the whole grid gets blocked (in less than 2 seconds) and I can't see what I'm typing in the input box. Could somebody tell me the optimal way to filter those 20k rows with the search by filtering (not using filter by columns, it is really uncomfortable to use).

Thank you in advance.


Solution

  • The reason behind the slow filtering was that everytime I keypressed, I forced the grid (which has paging), to go to page 1 because if you filter from another page not being page 1, the filter does not work properly. What I did to solve it was to check whether that grid was at page 1 in every key press, and force it to go to page 1 only if the grid wasn't at page 1, and that solved the problem.