use jQuery to bind event
-> use JQuery to bind event on each <th> with a "data-sortt" attribute
This commit is contained in:
parent
d95a82e823
commit
f029789e11
16
sortt.js
16
sortt.js
@ -8,6 +8,22 @@
|
||||
|
||||
*/
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// Be sure you already have loaded jQuery !!! //
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
//use JQuery to bind event on each <th> with a "data-sortt" attribute
|
||||
$('th').each(function() {
|
||||
//console.log($(this));
|
||||
if ($(this)[0].dataset.sortt) $(this).on('click', function(e) {
|
||||
var data = $(this)[0].dataset.sortt
|
||||
data = data.split(",");
|
||||
sortt(data[0],data[1],data[2]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//create global function with main routine
|
||||
window.sortt=function(normsort,revsort,isdefault){
|
||||
//sortTable [normsort] (revsort) (isdefault)
|
||||
|
Reference in New Issue
Block a user