mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Core: optimize getColumnData
This commit is contained in:
parent
087ade7255
commit
5820c56282
@ -1224,17 +1224,19 @@
|
|||||||
table = $(table)[0];
|
table = $(table)[0];
|
||||||
var $h, k,
|
var $h, k,
|
||||||
c = table.config,
|
c = table.config,
|
||||||
$cell = ( $headers || c.$headers );
|
$cells = ( $headers || c.$headers ),
|
||||||
|
// c.$headerIndexed is not defined initially
|
||||||
|
$cell = c.$headerIndexed && c.$headerIndexed[indx] || $cells.filter('[data-column="' + indx + '"]:last');
|
||||||
if (obj[indx]) {
|
if (obj[indx]) {
|
||||||
return getCell ? obj[indx] : obj[$cell.index( $cell.filter('[data-column="' + indx + '"]:last') )];
|
return getCell ? obj[indx] : obj[$cells.index( $cell )];
|
||||||
}
|
}
|
||||||
for (k in obj) {
|
for (k in obj) {
|
||||||
if (typeof k === 'string') {
|
if (typeof k === 'string') {
|
||||||
$h = $cell.filter('[data-column="' + indx + '"]:last')
|
$h = $cell
|
||||||
// header cell with class/id
|
// header cell with class/id
|
||||||
.filter(k)
|
.filter(k)
|
||||||
// find elements within the header cell with cell/id
|
// find elements within the header cell with cell/id
|
||||||
.add( $cell.filter('[data-column="' + indx + '"]:last').find(k) );
|
.add( $cell.find(k) );
|
||||||
if ($h.length) {
|
if ($h.length) {
|
||||||
return obj[k];
|
return obj[k];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user