diff --git a/docs/example-update-cell.html b/docs/example-update-cell.html index 299116b1..93c7fab9 100644 --- a/docs/example-update-cell.html +++ b/docs/example-update-cell.html @@ -29,12 +29,13 @@ // randomize a number var resort = "", // resort variable set to anything BUT false (without quotes) will trigger the automatic resort - discount = '$' + Math.round(Math.random() * Math.random() * 100) + '.' + ('0' + Math.round(Math.random() * Math.random() * 100)).slice(-2); + discount = '$' + Math.round(Math.random() * Math.random() * 100) + '.' + ('0' + Math.round(Math.random() * Math.random() * 100)).slice(-2), + callback = function(table){ /* do something */ }; $(this).text(discount); // set resort flag to false to prevent automatic resort // leave the resort flag as undefined, or with any other value, to automatically resort the table - $("table").trigger("updateCell",[this, resort]); + $("table").trigger("updateCell",[this, resort, callback]); return false; }); diff --git a/docs/index.html b/docs/index.html index 7c7ed8ad..4d7d8ee9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2216,10 +2216,16 @@ $("table") $("td.discount").click(function(){ - // randomize a number + // Do we want to reapply the current sort on the column? var resort = false, + // Do something after the cell update in this callback function + callback = function(table){ + /* do something */ + }, + // randomize a number & add it to the cell discount = '$' + Math.round(Math.random() * Math.random() * 100) + '.' + ('0' + Math.round(Math.random() * Math.random() * 100)).slice(-2); + // add new table cell text $(this).text(discount); @@ -2227,7 +2233,7 @@ $("table") // set resort flag to false to prevent automatic resort (since we're using a different sort below) // leave the resort flag as undefined, or with any other value, to automatically resort the table // $("table").trigger("updateCell", [this]); < - resort is undefined so the table WILL resort - $("table").trigger("updateCell", [this, resort]); + $("table").trigger("updateCell", [this, resort, callback]); // As of version 2.0.14, the table will automatically resort (using the current sort selection) // after the update, so include the following if you want to specify a different sort