Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82143

Performance - How to pass all rows to other function on large table

$
0
0
Ive got a large table that im looking to improve performance on - Right now its at 13,000 rows but could potentially grow to 200,000 rows.

I have 2 major performance issues at present:

1) I need to be able to update a database field for all rows selected

Im currently using:
var sData = oTable.$('input').serialize();

To gather all rows in table (filtered) and i then pass sData via AJAX call to a PHP page that does the DB update.

The above line takes 5-10 seconds to complete for 13K rows. Any other options to gather all rows?


2) Checkall checkboxes

I currently have a checkbox column as my first column. My header has a "check all" checkbox above that column.

Im currently using the following code but it takes about 15 seconds to respond for 13K rows

$('input', oTable.$('tr', {"filter": "applied"} )).prop('checked',this.checked);
								
oTable.fnDraw();

I was thinking about using fnUpdate to see if its faster but struggling with JQuery syntax (not my native language!)

    for(i = 0; i < $dataTable.aaData.length ; ++i)
    {
          dataTable.fnUpdate( $dataTable.aaData[i].Value='checked', i, 0, false, false );
    }
    dataTable.fnDraw(); 

Any help would be much appreciated. Other option i can see is to move from AJAX source to full server side processing but this would again be a rewrite to try to get filtering, updates and tracking state of checkboxes across multiple pages working (Unless there is a better way to manage checkboxes etc?)

Matt

Viewing all articles
Browse latest Browse all 82143

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>