Parser: add select text parser. See #684

This commit is contained in:
Mottie 2014-07-15 17:14:27 -05:00
parent ad7468d5b0
commit e84f2992d4

View File

@ -64,6 +64,20 @@
type: "text" type: "text"
}); });
// Select parser to get the selected text
$.tablesorter.addParser({
id: "select-text",
is: function(){
return false;
},
format: function(s, table, cell) {
var $s = $(cell).find('select');
return $s.length ? $s.find('option:selected').text() || '' : 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