From f029789e1106d120bfd233e6ce8058c5512e279a Mon Sep 17 00:00:00 2001
From: 6543 <6543@obermui.de>
Date: Wed, 18 Sep 2019 02:24:52 +0200
Subject: [PATCH] use jQuery to bind event
-> use JQuery to bind event on each
with a "data-sortt" attribute
---
sortt.js | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/sortt.js b/sortt.js
index 2510120..2dda20c 100644
--- a/sortt.js
+++ b/sortt.js
@@ -8,6 +8,22 @@
*/
+/////////////////////////////////////////////////
+// Be sure you already have loaded jQuery !!! //
+/////////////////////////////////////////////////
+
+
+//use JQuery to bind event on each | 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)
|