How to filter a very large bootstrap table using pure Javascript

前端 未结 7 2168
清歌不尽
清歌不尽 2021-02-05 12:05

I\'ve built a large table in bootstrap, about 5,000 rows x 10 columns, and I need to filter the table for specific attributes, fast, using only JavaScript. The table has both an

7条回答
  •  情话喂你
    2021-02-05 13:00

    I would ask

    • Why you want to write this code for yourself? From personal experience, trying to filter efficiently and on all browsers is a non-trivial task.
    • If you are doing this as a learning experience, then look at source of the packages listed below as examples.
    • With 5000 rows, it would be more efficient to do server side filtering and sorting. Then use ajax to update the displayed table.

    I would suggest that you look at using one of the several JavaScript packages that already do this. There are many more packages that the two below. I'm showing these two as examples of what is available.

    • http://datatables.net/ - This is a very full featured package that handles both client and server side filtering and sorting.
    • http://www.listjs.com/ - is a lightweight client side filtering and sorting package.

提交回复
热议问题