use jQuery to bind event

-> use JQuery to bind event on each <th> with a "data-sortt" attribute
This commit is contained in:
6543 2019-09-18 02:24:52 +02:00
parent d95a82e823
commit f029789e11
Signed by: 6543
GPG Key ID: A1CA74D27FD13271
1 changed files with 16 additions and 0 deletions

View File

@ -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)