mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-10-08 13:44:18 +00:00
Add Parser for textareas and add it to the onchange auto cache rebuild
This commit is contained in:
parent
39e91a5733
commit
2211a91ae4
@ -78,6 +78,20 @@
|
|||||||
type: "text"
|
type: "text"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Custom parser for parsing textarea values
|
||||||
|
// updated dynamically using the "change" function below
|
||||||
|
$.tablesorter.addParser({
|
||||||
|
id: "textarea",
|
||||||
|
is: function(){
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
format: function(s, table, cell) {
|
||||||
|
return $(cell).find('textarea').val() || s;
|
||||||
|
},
|
||||||
|
parsed : true, // filter widget flag
|
||||||
|
type: "text"
|
||||||
|
});
|
||||||
|
|
||||||
// update select and all input types in the tablesorter cache when the change event fires.
|
// update select and all input types in the tablesorter cache when the change event fires.
|
||||||
// This method only works with jQuery 1.7+
|
// This method only works with jQuery 1.7+
|
||||||
// you can change it to use delegate (v1.4.3+) or live (v1.3+) as desired
|
// you can change it to use delegate (v1.4.3+) or live (v1.3+) as desired
|
||||||
@ -88,7 +102,7 @@
|
|||||||
// it happens when you modify input text and hit enter
|
// it happens when you modify input text and hit enter
|
||||||
var alreadyUpdating = false;
|
var alreadyUpdating = false;
|
||||||
// bind to .tablesorter (default class name)
|
// bind to .tablesorter (default class name)
|
||||||
$(this).children('tbody').on('change', 'select, input', function(e){
|
$(this).children('tbody').on('change', 'select, input, textarea', function(e){
|
||||||
if (!alreadyUpdating) {
|
if (!alreadyUpdating) {
|
||||||
var $tar = $(e.target),
|
var $tar = $(e.target),
|
||||||
$cell = $tar.closest('td'),
|
$cell = $tar.closest('td'),
|
||||||
|
Loading…
Reference in New Issue
Block a user