Core: include extraTables along with extraHeaders

Also replace instances of tagName with nodeName
This commit is contained in:
Mottie 2015-03-23 16:10:37 -05:00
parent 7f37b90ebd
commit fd693b6d87

View File

@ -1067,7 +1067,7 @@
// save initial settings
c.originalSettings = settings;
// create a table from data (build table widget)
if (!table.hasInitialized && ts.buildTable && this.tagName !== 'TABLE') {
if (!table.hasInitialized && ts.buildTable && this.nodeName !== 'TABLE') {
// return the table (in case the original target is the table's container)
ts.buildTable(table, c);
} else {
@ -1334,10 +1334,14 @@
ts.bindEvents = function(table, $headers, core){
table = $(table)[0];
var downTarget = null,
var t, downTarget = null,
c = table.config;
if (core !== true) {
c.$extraHeaders = c.$extraHeaders ? c.$extraHeaders.add($headers) : $headers;
t = $.fn.closest ? $headers.closest('table')[0] : $headers.parents('table')[0];
if (t && t.nodeName === 'TABLE' && t !== table) {
c.$extraTables = c.$extraTables ? c.$extraTables.add(t) : $(t);
}
}
// apply event handling to headers and/or additional headers (stickyheaders, scroller, etc)
$headers
@ -1365,7 +1369,7 @@
}
downTarget = null;
// prevent sort being triggered on form elements
if ( /(input|select|button|textarea)/i.test(e.target.tagName) ||
if ( /(input|select|button|textarea)/i.test(e.target.nodeName) ||
// nosort class name, or elements within a nosort container
$target.hasClass(c.cssNoSort) || $target.parents('.' + c.cssNoSort).length > 0 ||
// elements within a button
@ -1374,7 +1378,7 @@
}
if (c.delayInit && isEmptyObject(c.cache)) { buildCache(table); }
// jQuery v1.2.6 doesn't have closest()
cell = $.fn.closest ? $(this).closest('th, td')[0] : /TH|TD/.test(this.tagName) ? this : $(this).parents('th, td')[0];
cell = $.fn.closest ? $(this).closest('th, td')[0] : /TH|TD/.test(this.nodeName) ? this : $(this).parents('th, td')[0];
// reference original table headers and find the same cell
cell = c.$headers[ $headers.index( cell ) ];
if (!cell.sortDisabled) {
@ -2053,7 +2057,7 @@
format: function(table, c, wo) {
var $tb, $tv, $tr, row, even, time, k,
child = new RegExp(c.cssChildRow, 'i'),
b = c.$tbodies;
b = c.$tbodies.add( c.$extraTables && c.$extraTables.children( 'tbody' ) );
if (c.debug) {
time = new Date();
}