Core: Add updateHeaders method. See #989

This commit is contained in:
Mottie 2015-08-17 20:07:49 -05:00
parent e8bc2bef2e
commit 2b8a104e1e
12 changed files with 175 additions and 82 deletions

View File

@ -1,4 +1,4 @@
/*! tablesorter (FORK) - updated 08-16-2015 (v2.22.5)*/
/*! tablesorter (FORK) - updated 08-17-2015 (v2.22.5)*/
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
(function(factory) {
if (typeof define === 'function' && define.amd) {
@ -432,9 +432,8 @@
return (/^d/i.test(v) || v === 1);
}
function buildHeaders(table) {
var ch, $t, h, i, t, lock, time, indx,
c = table.config;
function buildHeaders( c ) {
var ch, $t, h, i, t, lock, time, indx;
c.headerList = [];
c.headerContent = [];
if (c.debug) {
@ -445,12 +444,12 @@
// add icon if cssIcon option exists
i = c.cssIcon ? '<i class="' + ( c.cssIcon === ts.css.icon ? ts.css.icon : c.cssIcon + ' ' + ts.css.icon ) + '"></i>' : '';
// redefine c.$headers here in case of an updateAll that replaces or adds an entire header cell - see #683
c.$headers = $( $.map( $(table).find(c.selectorHeaders), function(elem, index) {
c.$headers = $( $.map( c.$table.find(c.selectorHeaders), function(elem, index) {
$t = $(elem);
// ignore cell (don't add it to c.$headers) if row has ignoreRow class
if ($t.parent().hasClass(c.cssIgnoreRow)) { return; }
// make sure to get header cell & not column indexed cell
ch = ts.getColumnData( table, c.headers, index, true );
ch = ts.getColumnData( c.table, c.headers, index, true );
// save original header content
c.headerContent[index] = $t.html();
// if headerTemplate is empty, don't reformat the header cell
@ -492,12 +491,12 @@
// .last() added in jQuery 1.4; use .filter(':last') to maintain compatibility with jQuery v1.2.6
c.$headerIndexed[indx] = $t.not('.sorter-false').length ? $t.not('.sorter-false').filter(':last') : $t.filter(':last');
}
$(table).find(c.selectorHeaders).attr({
c.$table.find(c.selectorHeaders).attr({
scope: 'col',
role : 'columnheader'
});
// enable/disable sorting
updateHeader(table);
updateHeader(c.table);
if (c.debug) {
console.log( 'Built headers:' + ts.benchmark( time ) );
console.log( c.$headers );
@ -863,8 +862,9 @@
function bindMethods( table ){
var c = table.config,
$table = c.$table,
events = ( 'sortReset update updateRows updateCell updateAll addRows updateComplete sorton appendCache ' +
'updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave ' ).split( ' ' )
events = ( 'sortReset update updateRows updateAll updateHeaders addRows updateCell updateComplete ' +
'sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup ' +
'mouseleave ' ).split( ' ' )
.join( c.namespace + ' ' );
// apply easy methods that trigger bound events
$table
@ -882,6 +882,10 @@
e.stopPropagation();
ts.update( this.config, resort, callback );
})
.bind( 'updateHeaders' + c.namespace, function( e, callback ) {
e.stopPropagation();
ts.updateHeaders( this.config, callback );
})
.bind( 'updateCell' + c.namespace, function(e, cell, resort, callback ) {
e.stopPropagation();
ts.updateCell( this.config, cell, resort, callback );
@ -1028,7 +1032,7 @@
// change textExtraction via data-attribute
c.textExtraction = c.$table.attr('data-text-extraction') || c.textExtraction || 'basic';
// build headers
buildHeaders(table);
buildHeaders( c );
// fixate columns if the users supplies the fixedWidth option
// do this after theme has been applied
ts.fixColumnWidth(table);
@ -1317,7 +1321,7 @@
var table = c.table;
table.isUpdating = true;
ts.refreshWidgets( table, true, true );
buildHeaders( table );
buildHeaders( c );
ts.bindEvents( table, c.$headers, true );
bindMethods( table);
commonUpdate( table, resort, callback );
@ -1331,6 +1335,14 @@
commonUpdate( table, resort, callback );
};
// simple header update - see #989
ts.updateHeaders = function( c, callback ) {
c.table.isUpdating = true;
buildHeaders( c );
ts.bindEvents( c.table, c.$headers, true );
resortComplete( c, callback );
};
ts.updateCell = function( c, cell, resort, callback ) {
c.table.isUpdating = true;
c.$table.find( c.selectorRemove ).remove();
@ -1364,10 +1376,7 @@
} else {
// don't reapply widgets is resort is false, just in case it causes
// problems with element focus
if ( $.isFunction( callback ) ) {
callback( table );
}
c.$table.trigger( 'updateComplete', c.table );
resortComplete( c, callback );
}
}
};
@ -1548,8 +1557,9 @@
// remove widget added rows, just in case
$h.find('tr').not($r).remove();
// disable tablesorter
events = 'sortReset update updateAll updateRows updateCell addRows updateComplete sorton appendCache updateCache ' +
'applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress sortBegin sortEnd resetToLoadState '.split(' ')
events = 'sortReset update updateRows updateAll updateHeaders updateCell addRows updateComplete sorton ' +
'appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress ' +
'sortBegin sortEnd resetToLoadState '.split(' ')
.join(c.namespace + ' ');
$t
.removeData('tablesorter')

File diff suppressed because one or more lines are too long

View File

@ -430,9 +430,8 @@
return (/^d/i.test(v) || v === 1);
}
function buildHeaders(table) {
var ch, $t, h, i, t, lock, time, indx,
c = table.config;
function buildHeaders( c ) {
var ch, $t, h, i, t, lock, time, indx;
c.headerList = [];
c.headerContent = [];
if (c.debug) {
@ -443,12 +442,12 @@
// add icon if cssIcon option exists
i = c.cssIcon ? '<i class="' + ( c.cssIcon === ts.css.icon ? ts.css.icon : c.cssIcon + ' ' + ts.css.icon ) + '"></i>' : '';
// redefine c.$headers here in case of an updateAll that replaces or adds an entire header cell - see #683
c.$headers = $( $.map( $(table).find(c.selectorHeaders), function(elem, index) {
c.$headers = $( $.map( c.$table.find(c.selectorHeaders), function(elem, index) {
$t = $(elem);
// ignore cell (don't add it to c.$headers) if row has ignoreRow class
if ($t.parent().hasClass(c.cssIgnoreRow)) { return; }
// make sure to get header cell & not column indexed cell
ch = ts.getColumnData( table, c.headers, index, true );
ch = ts.getColumnData( c.table, c.headers, index, true );
// save original header content
c.headerContent[index] = $t.html();
// if headerTemplate is empty, don't reformat the header cell
@ -490,12 +489,12 @@
// .last() added in jQuery 1.4; use .filter(':last') to maintain compatibility with jQuery v1.2.6
c.$headerIndexed[indx] = $t.not('.sorter-false').length ? $t.not('.sorter-false').filter(':last') : $t.filter(':last');
}
$(table).find(c.selectorHeaders).attr({
c.$table.find(c.selectorHeaders).attr({
scope: 'col',
role : 'columnheader'
});
// enable/disable sorting
updateHeader(table);
updateHeader(c.table);
if (c.debug) {
console.log( 'Built headers:' + ts.benchmark( time ) );
console.log( c.$headers );
@ -861,8 +860,9 @@
function bindMethods( table ){
var c = table.config,
$table = c.$table,
events = ( 'sortReset update updateRows updateCell updateAll addRows updateComplete sorton appendCache ' +
'updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave ' ).split( ' ' )
events = ( 'sortReset update updateRows updateAll updateHeaders addRows updateCell updateComplete ' +
'sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup ' +
'mouseleave ' ).split( ' ' )
.join( c.namespace + ' ' );
// apply easy methods that trigger bound events
$table
@ -880,6 +880,10 @@
e.stopPropagation();
ts.update( this.config, resort, callback );
})
.bind( 'updateHeaders' + c.namespace, function( e, callback ) {
e.stopPropagation();
ts.updateHeaders( this.config, callback );
})
.bind( 'updateCell' + c.namespace, function(e, cell, resort, callback ) {
e.stopPropagation();
ts.updateCell( this.config, cell, resort, callback );
@ -1026,7 +1030,7 @@
// change textExtraction via data-attribute
c.textExtraction = c.$table.attr('data-text-extraction') || c.textExtraction || 'basic';
// build headers
buildHeaders(table);
buildHeaders( c );
// fixate columns if the users supplies the fixedWidth option
// do this after theme has been applied
ts.fixColumnWidth(table);
@ -1315,7 +1319,7 @@
var table = c.table;
table.isUpdating = true;
ts.refreshWidgets( table, true, true );
buildHeaders( table );
buildHeaders( c );
ts.bindEvents( table, c.$headers, true );
bindMethods( table);
commonUpdate( table, resort, callback );
@ -1329,6 +1333,14 @@
commonUpdate( table, resort, callback );
};
// simple header update - see #989
ts.updateHeaders = function( c, callback ) {
c.table.isUpdating = true;
buildHeaders( c );
ts.bindEvents( c.table, c.$headers, true );
resortComplete( c, callback );
};
ts.updateCell = function( c, cell, resort, callback ) {
c.table.isUpdating = true;
c.$table.find( c.selectorRemove ).remove();
@ -1362,10 +1374,7 @@
} else {
// don't reapply widgets is resort is false, just in case it causes
// problems with element focus
if ( $.isFunction( callback ) ) {
callback( table );
}
c.$table.trigger( 'updateComplete', c.table );
resortComplete( c, callback );
}
}
};
@ -1546,8 +1555,9 @@
// remove widget added rows, just in case
$h.find('tr').not($r).remove();
// disable tablesorter
events = 'sortReset update updateAll updateRows updateCell addRows updateComplete sorton appendCache updateCache ' +
'applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress sortBegin sortEnd resetToLoadState '.split(' ')
events = 'sortReset update updateRows updateAll updateHeaders updateCell addRows updateComplete sorton ' +
'appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress ' +
'sortBegin sortEnd resetToLoadState '.split(' ')
.join(c.namespace + ' ');
$t
.removeData('tablesorter')

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/*! tablesorter (FORK) - updated 08-16-2015 (v2.22.5)*/
/*! tablesorter (FORK) - updated 08-17-2015 (v2.22.5)*/
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
(function(factory) {
if (typeof define === 'function' && define.amd) {

File diff suppressed because one or more lines are too long

View File

@ -4863,6 +4863,45 @@ $("table")
<td></td>
</tr>
<tr id="updateheaders">
<td><a href="#" class="permalink">updateHeaders</a></td>
<td>Refresh table headers only (<span class="version">v2.23.0</span>).
<div class="collapsible">
<h4>Direct method:</h4>
<p>In <span class="version">v2.23.0</span>, this method can be called directly as follows:</p>
<pre class="prettyprint lang-js">var config = $( 'table' )[ 0 ].config,
callback = function( table ) {
// do something
};
$.tablesorter.updateHeaders( config, callback );</pre>
<h4>Triggered event method:</h4>
<pre class="prettyprint lang-js">$(function() {
$( 'table' ).tablesorter();
// click on a button somewhere on the page to update header index
$( 'button' ).click( function() {
// Do something after the cell update in this callback function
var $headerCell = $('thead th:eq(1)'),
index = $headerCell.data( 'counter' ) || 0,
callback = function( table ) {
/* do something */
};
// change header text
$headerCell
.html( 'header click #' + index )
// update header data
.data( 'counter', index++ );
// update the header, includes rebinding events & using the header template
$( 'table' ).trigger( 'updateHeaders', callback );
return false;
});
});</pre></div>
</td>
<td></td>
</tr>
<tr id="updatecell">
<td><a href="#" class="permalink">updateCell</a></td>
<td>Update a table cell in the tablesorter data (<span class="version updated">v2.23.0</span>).

View File

@ -4,7 +4,7 @@
*/
/*! tablesorter (FORK) - updated 08-16-2015 (v2.22.5)*/
/*! tablesorter (FORK) - updated 08-17-2015 (v2.22.5)*/
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
(function(factory) {
if (typeof define === 'function' && define.amd) {
@ -438,9 +438,8 @@
return (/^d/i.test(v) || v === 1);
}
function buildHeaders(table) {
var ch, $t, h, i, t, lock, time, indx,
c = table.config;
function buildHeaders( c ) {
var ch, $t, h, i, t, lock, time, indx;
c.headerList = [];
c.headerContent = [];
if (c.debug) {
@ -451,12 +450,12 @@
// add icon if cssIcon option exists
i = c.cssIcon ? '<i class="' + ( c.cssIcon === ts.css.icon ? ts.css.icon : c.cssIcon + ' ' + ts.css.icon ) + '"></i>' : '';
// redefine c.$headers here in case of an updateAll that replaces or adds an entire header cell - see #683
c.$headers = $( $.map( $(table).find(c.selectorHeaders), function(elem, index) {
c.$headers = $( $.map( c.$table.find(c.selectorHeaders), function(elem, index) {
$t = $(elem);
// ignore cell (don't add it to c.$headers) if row has ignoreRow class
if ($t.parent().hasClass(c.cssIgnoreRow)) { return; }
// make sure to get header cell & not column indexed cell
ch = ts.getColumnData( table, c.headers, index, true );
ch = ts.getColumnData( c.table, c.headers, index, true );
// save original header content
c.headerContent[index] = $t.html();
// if headerTemplate is empty, don't reformat the header cell
@ -498,12 +497,12 @@
// .last() added in jQuery 1.4; use .filter(':last') to maintain compatibility with jQuery v1.2.6
c.$headerIndexed[indx] = $t.not('.sorter-false').length ? $t.not('.sorter-false').filter(':last') : $t.filter(':last');
}
$(table).find(c.selectorHeaders).attr({
c.$table.find(c.selectorHeaders).attr({
scope: 'col',
role : 'columnheader'
});
// enable/disable sorting
updateHeader(table);
updateHeader(c.table);
if (c.debug) {
console.log( 'Built headers:' + ts.benchmark( time ) );
console.log( c.$headers );
@ -869,8 +868,9 @@
function bindMethods( table ){
var c = table.config,
$table = c.$table,
events = ( 'sortReset update updateRows updateCell updateAll addRows updateComplete sorton appendCache ' +
'updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave ' ).split( ' ' )
events = ( 'sortReset update updateRows updateAll updateHeaders addRows updateCell updateComplete ' +
'sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup ' +
'mouseleave ' ).split( ' ' )
.join( c.namespace + ' ' );
// apply easy methods that trigger bound events
$table
@ -888,6 +888,10 @@
e.stopPropagation();
ts.update( this.config, resort, callback );
})
.bind( 'updateHeaders' + c.namespace, function( e, callback ) {
e.stopPropagation();
ts.updateHeaders( this.config, callback );
})
.bind( 'updateCell' + c.namespace, function(e, cell, resort, callback ) {
e.stopPropagation();
ts.updateCell( this.config, cell, resort, callback );
@ -1034,7 +1038,7 @@
// change textExtraction via data-attribute
c.textExtraction = c.$table.attr('data-text-extraction') || c.textExtraction || 'basic';
// build headers
buildHeaders(table);
buildHeaders( c );
// fixate columns if the users supplies the fixedWidth option
// do this after theme has been applied
ts.fixColumnWidth(table);
@ -1323,7 +1327,7 @@
var table = c.table;
table.isUpdating = true;
ts.refreshWidgets( table, true, true );
buildHeaders( table );
buildHeaders( c );
ts.bindEvents( table, c.$headers, true );
bindMethods( table);
commonUpdate( table, resort, callback );
@ -1337,6 +1341,14 @@
commonUpdate( table, resort, callback );
};
// simple header update - see #989
ts.updateHeaders = function( c, callback ) {
c.table.isUpdating = true;
buildHeaders( c );
ts.bindEvents( c.table, c.$headers, true );
resortComplete( c, callback );
};
ts.updateCell = function( c, cell, resort, callback ) {
c.table.isUpdating = true;
c.$table.find( c.selectorRemove ).remove();
@ -1370,10 +1382,7 @@
} else {
// don't reapply widgets is resort is false, just in case it causes
// problems with element focus
if ( $.isFunction( callback ) ) {
callback( table );
}
c.$table.trigger( 'updateComplete', c.table );
resortComplete( c, callback );
}
}
};
@ -1554,8 +1563,9 @@
// remove widget added rows, just in case
$h.find('tr').not($r).remove();
// disable tablesorter
events = 'sortReset update updateAll updateRows updateCell addRows updateComplete sorton appendCache updateCache ' +
'applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress sortBegin sortEnd resetToLoadState '.split(' ')
events = 'sortReset update updateRows updateAll updateHeaders updateCell addRows updateComplete sorton ' +
'appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress ' +
'sortBegin sortEnd resetToLoadState '.split(' ')
.join(c.namespace + ' ');
$t
.removeData('tablesorter')

View File

@ -420,9 +420,8 @@
return (/^d/i.test(v) || v === 1);
}
function buildHeaders(table) {
var ch, $t, h, i, t, lock, time, indx,
c = table.config;
function buildHeaders( c ) {
var ch, $t, h, i, t, lock, time, indx;
c.headerList = [];
c.headerContent = [];
if (c.debug) {
@ -433,12 +432,12 @@
// add icon if cssIcon option exists
i = c.cssIcon ? '<i class="' + ( c.cssIcon === ts.css.icon ? ts.css.icon : c.cssIcon + ' ' + ts.css.icon ) + '"></i>' : '';
// redefine c.$headers here in case of an updateAll that replaces or adds an entire header cell - see #683
c.$headers = $( $.map( $(table).find(c.selectorHeaders), function(elem, index) {
c.$headers = $( $.map( c.$table.find(c.selectorHeaders), function(elem, index) {
$t = $(elem);
// ignore cell (don't add it to c.$headers) if row has ignoreRow class
if ($t.parent().hasClass(c.cssIgnoreRow)) { return; }
// make sure to get header cell & not column indexed cell
ch = ts.getColumnData( table, c.headers, index, true );
ch = ts.getColumnData( c.table, c.headers, index, true );
// save original header content
c.headerContent[index] = $t.html();
// if headerTemplate is empty, don't reformat the header cell
@ -480,12 +479,12 @@
// .last() added in jQuery 1.4; use .filter(':last') to maintain compatibility with jQuery v1.2.6
c.$headerIndexed[indx] = $t.not('.sorter-false').length ? $t.not('.sorter-false').filter(':last') : $t.filter(':last');
}
$(table).find(c.selectorHeaders).attr({
c.$table.find(c.selectorHeaders).attr({
scope: 'col',
role : 'columnheader'
});
// enable/disable sorting
updateHeader(table);
updateHeader(c.table);
if (c.debug) {
console.log( 'Built headers:' + ts.benchmark( time ) );
console.log( c.$headers );
@ -851,8 +850,9 @@
function bindMethods( table ){
var c = table.config,
$table = c.$table,
events = ( 'sortReset update updateRows updateCell updateAll addRows updateComplete sorton appendCache ' +
'updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave ' ).split( ' ' )
events = ( 'sortReset update updateRows updateAll updateHeaders addRows updateCell updateComplete ' +
'sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup ' +
'mouseleave ' ).split( ' ' )
.join( c.namespace + ' ' );
// apply easy methods that trigger bound events
$table
@ -870,6 +870,10 @@
e.stopPropagation();
ts.update( this.config, resort, callback );
})
.bind( 'updateHeaders' + c.namespace, function( e, callback ) {
e.stopPropagation();
ts.updateHeaders( this.config, callback );
})
.bind( 'updateCell' + c.namespace, function(e, cell, resort, callback ) {
e.stopPropagation();
ts.updateCell( this.config, cell, resort, callback );
@ -1016,7 +1020,7 @@
// change textExtraction via data-attribute
c.textExtraction = c.$table.attr('data-text-extraction') || c.textExtraction || 'basic';
// build headers
buildHeaders(table);
buildHeaders( c );
// fixate columns if the users supplies the fixedWidth option
// do this after theme has been applied
ts.fixColumnWidth(table);
@ -1305,7 +1309,7 @@
var table = c.table;
table.isUpdating = true;
ts.refreshWidgets( table, true, true );
buildHeaders( table );
buildHeaders( c );
ts.bindEvents( table, c.$headers, true );
bindMethods( table);
commonUpdate( table, resort, callback );
@ -1319,6 +1323,14 @@
commonUpdate( table, resort, callback );
};
// simple header update - see #989
ts.updateHeaders = function( c, callback ) {
c.table.isUpdating = true;
buildHeaders( c );
ts.bindEvents( c.table, c.$headers, true );
resortComplete( c, callback );
};
ts.updateCell = function( c, cell, resort, callback ) {
c.table.isUpdating = true;
c.$table.find( c.selectorRemove ).remove();
@ -1352,10 +1364,7 @@
} else {
// don't reapply widgets is resort is false, just in case it causes
// problems with element focus
if ( $.isFunction( callback ) ) {
callback( table );
}
c.$table.trigger( 'updateComplete', c.table );
resortComplete( c, callback );
}
}
};
@ -1536,8 +1545,9 @@
// remove widget added rows, just in case
$h.find('tr').not($r).remove();
// disable tablesorter
events = 'sortReset update updateAll updateRows updateCell addRows updateComplete sorton appendCache updateCache ' +
'applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress sortBegin sortEnd resetToLoadState '.split(' ')
events = 'sortReset update updateRows updateAll updateHeaders updateCell addRows updateComplete sorton ' +
'appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress ' +
'sortBegin sortEnd resetToLoadState '.split(' ')
.join(c.namespace + ' ');
$t
.removeData('tablesorter')

View File

@ -4,7 +4,7 @@
*/
/*! tablesorter (FORK) - updated 08-16-2015 (v2.22.5)*/
/*! tablesorter (FORK) - updated 08-17-2015 (v2.22.5)*/
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
(function(factory) {
if (typeof define === 'function' && define.amd) {

View File

@ -41,7 +41,7 @@
<table id="table1" class="tester" data-text-extraction="basic">
<thead>
<tr><th class="{sortValue:'zzz', poe:'nevermore'}">test-head</th><th>num</th></tr>
<tr><th class="{sortValue:'zzz', poe:'nevermore'}">test-head</th><th>xnum</th></tr>
</thead>
<tfoot>
<tr><th>test-foot</th><th>txt</th></tr>

View File

@ -656,7 +656,7 @@ jQuery(function($){
test update methods
************************************************/
QUnit.test( 'parser cache; update methods & callbacks', function(assert) {
assert.expect(11);
assert.expect(12);
var oldColMax;
c1.ignoreCase = true;
// updateAll
@ -671,15 +671,29 @@ jQuery(function($){
.trigger('updateAll', [false, function(){
updateCallback++;
var nw = $table1.find('th:eq(1)')[0],
ht = c1.$headers.eq(1).text() === 'num'
hc = c1.headerContent[1] === 'num',
hd = c1.$headers[1] === nw,
hl = c1.headerList[1] === nw,
p1 = c1.parsers[1].id === 'digit';
assert.equal(hc && hd && hl && p1, true, 'testing header cache: updateAll - thead');
assert.equal(ht && hc && hd && hl && p1, true, 'testing header cache: updateAll - thead');
assert.cacheCompare( table1, 'all', [ 'test3', 1, 'test2', 2, 'test1', 3,
'testc', 4, 'testb', 5, 'testa', 6, '', 0 ], 'updateAll - tbody' );
}]);
// updateHeader v2.22.6
$table1
.find('th:eq(1)').html('x-num').end()
.trigger('updateHeaders', function(){
updateCallback++;
var nw = $table1.find('th:eq(1)')[0],
ht = c1.$headers.eq(1).text() === 'x-num',
hc = c1.headerContent[1] === 'x-num',
hd = c1.$headers[1] === nw,
hl = c1.headerList[1] === nw;
assert.equal(ht && hc && hd && hl, true, 'testing header cache: updateHeaders');
});
// addRows
t = $('<tr class="temp"><td>testd</td><td>7</td></tr>');
$table1.find('tbody:last').prepend(t);