From 278fbccad73fdec501f8889d76f09ea6273cadc9 Mon Sep 17 00:00:00 2001 From: Mottie Date: Mon, 27 Oct 2014 19:50:41 -0500 Subject: [PATCH] Core: add cssAllowClicks option --- docs/index.html | 8 ++++++++ js/jquery.tablesorter.js | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/index.html b/docs/index.html index a049bc9a..37314db8 100644 --- a/docs/index.html +++ b/docs/index.html @@ -775,6 +775,14 @@ + + cssAllowClicks + String + "tablesorter-allow-clicks" + Class name added to table header which allows clicks to bubble up. (v2.18.1). + + + String diff --git a/js/jquery.tablesorter.js b/js/jquery.tablesorter.js index 1fdc8ee2..8963736e 100644 --- a/js/jquery.tablesorter.js +++ b/js/jquery.tablesorter.js @@ -92,6 +92,7 @@ cssChildRow : 'tablesorter-childRow', // class name indiciating that a row is to be attached to the its parent cssIcon : 'tablesorter-icon', // if this class exists, a will be added to the header automatically cssInfoBlock : 'tablesorter-infoOnly', // don't sort tbody with this class name (only one class name allowed here!) + cssAllowClicks : 'tablesorter-allowClicks', // class name added to table header which allows clicks to bubble up // *** selectors selectorHeaders : '> thead th, > thead td', @@ -1286,7 +1287,9 @@ // set timer on mousedown if (type === 'mousedown') { downTime = new Date().getTime(); - return /(input|select|button|textarea)/i.test(e.target.tagName) ? '' : !c.cancelSelection; + return /(input|select|button|textarea)/i.test(e.target.tagName) || + // allow clicks to contents of selected cells + $(e.target).closest('td,th').hasClass(c.cssAllowClicks) ? '' : !c.cancelSelection; } if (c.delayInit && isEmptyObject(c.cache)) { buildCache(table); } // jQuery v1.2.6 doesn't have closest()