mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Added missing docs - updateCell method has a callback
This commit is contained in:
parent
bde4482241
commit
c2f168f64f
@ -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;
|
||||
});
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user