I have been using the DataTables plugin for jQuery (http://www.datatables.net) to search, sort and paginate tabular data on the client. The simplicity of implementation and smooth user experience have been a huge win.
Now I have a requirement to implement the same functionality (search, sort, paginate) over a larger set of data, max 1000 records. I was hoping to use the same plug-in for this, but it seems that the performance of DataTables degrades steeply when the number of records in the table increases. On IE8, a table of 500 trs already causes the “A script on this page is running slow” alert.
Because the datasets are not that huge, I would very much like to do this on the client if possible.
Is there any way to improve the performance of DataTables plugin by changing the rendered markup, disabling some features, feeding the data as JSON instead of HTML or otherwise configuring it to achieve sensible performance for 1000 client-side records on most modern browsers (IE7+, FF2+, Chrome).
Alternatively, are there any other javascript libraries, preferably jQuery, which could offer similar functionality?
This is fixed in a recent build of DataTables (v1.7.5+). The author changed the sort implementation to not use eval or $.inArray().
Direct download link: http://datatables.net/download/build/jquery.dataTables.nightly.js
From the change log:
Performance: Re-written the sorting implementation so it doesn’t use either eval() of $.inArray(). inArray was found to have a serious negative effect on IE which counts operations to give the ‘script is running slow’ error message – the new implemention uses a value / key reverse mapping to make the look up as fast as a single object parameter retreival.
Grab the build with the following info (or later)
Nightly: 1.7.5.dev Sunday 28th November 2010, 14:42 Download Download min Notes