Plugin for batch cell update

Plugin for batch cell update

alexogaralexogar Posts: 1Questions: 0Answers: 0
edited March 2012 in Plug-ins
Hello All, I'm new with DataTables and this forum.
Could someone review that plugin for problems or something that I shouldn't do?

This plugin should call only one rerender per multiple row updates.

[code]
(function($) {
/**
* This will create batch update of multiple rows with one rerender.
* It`s implemented in datatables plugin style.
*
* @param rows {
* iRow1 : [data,data,data,data]
* }
*/
$.fn.dataTableExt.oApi.fnUpdateRows = function(oSettings,rows) {


for (var iRow in rows) {

//Sets internal data
oSettings.aoData[iRow]._aData = rows[iRow].slice();
//Gets array of row tds
var tds = oSettings.oApi._fnGetTdNodes(oSettings, iRow);

for ( var iColumn=0 ; iColumn

Replies

  • allanallan Posts: 63,683Questions: 1Answers: 10,498 Site admin
    Absolutely superb - nice one! Thanks very much for sharing this with us!

    One thing that I can see is that I don't think it will cope with objects being used for the data source: http://datatables.net/blog/Extended_data_source_options_with_DataTables . Implementing that can get a little messy (see my fnUpdate code...) due to the nesting of objects, so I wonder if it might be an idea to just loop over the data and pass it to fnUpdate with fnUpdate set to not redraw, and then when the loop is done do a redraw?

    Allan
This discussion has been closed.