Cell column property has correct value again. Fixes #551

This commit is contained in:
Mottie 2014-03-29 16:22:07 -05:00
parent 9bfd2ee0ac
commit a22cfae71c

View File

@ -394,7 +394,7 @@
for (j = 0; j < cells.length; j++) {
c = cells[j];
rowIndex = c.parentNode.rowIndex;
cellId = rowIndex + "-" + $(c).cellIndex;
cellId = rowIndex + "-" + $(c).index();
rowSpan = c.rowSpan || 1;
colSpan = c.colSpan || 1;
if (typeof(matrix[rowIndex]) === "undefined") {
@ -424,7 +424,6 @@
}
// may not be accurate if # header columns !== # tbody columns
t.config.columns = cols + 1; // add one because it's a zero-based index
return lookup;
}
function formatSortingOrder(v) {
@ -433,13 +432,15 @@
}
function buildHeaders(table) {
var header_index = computeThIndexes(table), ch, $t,
h, i, t, lock, time, c = table.config;
var ch, $t,
h, i, t, lock, time,
c = table.config;
c.headerList = [];
c.headerContent = [];
if (c.debug) {
time = new Date();
}
computeThIndexes(table);
// 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>' : '';
c.$headers = $(table).find(c.selectorHeaders).each(function(index) {
@ -455,8 +456,7 @@
$(this).html('<div class="' + ts.css.headerIn + '">' + t + '</div>'); // faster than wrapInner
if (c.onRenderHeader) { c.onRenderHeader.apply($t, [index]); }
this.column = header_index[this.parentNode.rowIndex + "-" + $(this).cellIndex];
this.column = parseInt( $(this).attr('data-column'), 10);
this.order = formatSortingOrder( ts.getData($t, ch, 'sortInitialOrder') || c.sortInitialOrder ) ? [1,0,2] : [0,1,2];
this.count = -1; // set to -1 because clicking on the header automatically adds one
this.lockedOrder = false;
@ -829,9 +829,9 @@
// tbody may not exist if update is initialized while tbody is removed for processing
if ($tb.length && tbdy >= 0) {
row = $tb.eq(tbdy).find('tr').index( $row );
icell = $(cell).cellIndex;
icell = $(cell).index();
l = c.cache[tbdy].normalized[row].length - 1;
c.cache[tbdy].row[table.config.cache[tbdy].normalized[row][l]] = $row;
c.cache[tbdy].row[ c.cache[tbdy].normalized[row][l] ] = $row;
c.cache[tbdy].normalized[row][icell] = c.parsers[icell].format( getElementText(table, cell, icell), table, cell, icell );
checkResort($table, resort, callback);
}