Ticket #2527707 (closed defect)

Reporter


Jenny Donnelly
Opened: 02/20/09
Last modified: 02/26/11
Status: closed
Type: defect
Resolution: fixed

Owner


Jenny Donnelly
Target Release: 2.9.0
Priority: P3 (normal)
Summary: Column sorting broken for DataTables nested in HTML TABLE elements
Description:

Regression caused by #2149587.

This patch can be used as a temporary workaround:

<script type="text/javascript">
YAHOO.widget.DataTable.prototype.getTdEl = function(cell) {
var Dom = YAHOO.util.Dom,
lang = YAHOO.lang,
elCell,
el = Dom.get(cell);

// Validate HTML element
if(el && (el.ownerDocument == document)) {
// Validate TD element
if(el.nodeName.toLowerCase() != "td") {
// Traverse up the DOM to find the corresponding TR element
elCell = Dom.getAncestorByTagName(el, "td");
}
else {
elCell = el;
}

// Make sure the TD is in this TBODY
if(elCell && (elCell.parentNode.parentNode == this._elTbody)) {
// Now we can return the TD element
return elCell;
}
}
else if(cell) {
var oRecord, nColKeyIndex;

if(lang.isString(cell.columnKey) && lang.isString(cell.recordId)) {
oRecord = this.getRecord(cell.recordId);
var oColumn = this.getColumn(cell.columnKey);
if(oColumn) {
nColKeyIndex = oColumn.getKeyIndex();
}

}
if(cell.record && cell.column && cell.column.getKeyIndex) {
oRecord = cell.record;
nColKeyIndex = cell.column.getKeyIndex();
}
var elRow = this.getTrEl(oRecord);
if((nColKeyIndex !== null) && elRow && elRow.cells && elRow.cells.length > 0) {
return elRow.cells[nColKeyIndex] || null;
}
}

return null;
};
</script>

Type: defect Observed in Version: 2.8.1
Component: DataTable Severity: S3 (normal)
Assigned To: Jenny Donnelly Target Release: 2.9.0
Location: Library Code Priority: P3 (normal)
Tags: Relates To:
Browsers: IE - All
URL:
Test Information:

Change History

Jenny Donnelly

YUI Developer

Posted: 02/20/09
  • status changed from new to accepted

Jenny Donnelly

YUI Developer

Posted: 02/20/09

Created commit 70cde92: [ref #2527707] Adding to known issues list.
1 files changed, 4 insertions(+), 0 deletions(-)

Jenny Donnelly

YUI Developer

Posted: 03/19/09

Sorry folks, there was a typo in that code. Please use this:

<script type="text/javascript">
YAHOO.widget.DataTable.prototype.getTdEl = function(cell) {

var Dom = YAHOO.util.Dom,

lang = YAHOO.lang,
elCell,
el = Dom.get(cell);

// Validate HTML element
if(el && (el.ownerDocument == document)) {

// Validate TD element
if(el.nodeName.toLowerCase() != "td") {

// Traverse up the DOM to find the corresponding TR element
elCell = Dom.getAncestorByTagName(el, "td");

}
else {

elCell = el;

}

// Make sure the TD is in this TBODY
if(elCell && (elCell.parentNode.parentNode == this._elTbody)) {

// Now we can return the TD element
return elCell;

}

}
else if(cell) {

var oRecord, nColKeyIndex;

if(lang.isString(cell.columnKey) && lang.isString(cell.recordId)) {

oRecord = this.getRecord(cell.recordId);
var oColumn = this.getColumn(cell.columnKey);
if(oColumn) {

nColKeyIndex = oColumn.getKeyIndex();

}

}
if(cell.record && cell.column && cell.column.getKeyIndex) {

oRecord = cell.record;
nColKeyIndex = cell.column.getKeyIndex();

}
var elRow = this.getTrEl(oRecord);
if((nColKeyIndex !== null) && elRow && elRow.cells && elRow.cells.length > 0) {

return elRow.cells[nColKeyIndex] || null;

}

}

return null;

};
</script>

Carlo Stearns

Posted: 04/15/09

This patch worked great except I had to change "return elRow.cells[nColKeyIndex] null;" to "return elRow.cells[nColKeyIndex];"

Dave Bristor

Posted: 04/20/09
  • browser changed to N/A

Jenny Donnelly

YUI Developer

Posted: 07/4/09
  • milestone changed from 2.NEXT to 2.8.0

Jenny Donnelly

YUI Developer

Posted: 07/4/09

Ticket #2528034 was marked as a duplicate of this ticket.

Jenny Donnelly

YUI Developer

Posted: 07/21/09
  • status changed from accepted to checkedin

Created commit 297de75: [fix bug #2527707] Fix column sorting for DataTables nested in TABLE elements: getTdEl() validates that TD is in this TBODY.

Jenny Donnelly

YUI Developer

Posted: 07/22/09

[fix bug #2527707] Fix column sorting for DataTables nested in TABLE elements: getTdEl() validates that TD is in this TBODY.
View Commit: 297de7552371af7f87e2aa88b739d8e917b0ba2f

Jenny Donnelly

YUI Developer

Posted: 08/5/09
  • status changed from checkedin to reopened

Regression of bug bz2263558/sf2149587.

Jenny Donnelly

YUI Developer

Posted: 08/5/09
  • status changed from reopened to checkedin

Created commit 719a2a5: [fix bug #2527707] getTdEl needs to validate TD.parentNode.parentNode is this TBODY (for column sorting of DTs nested in table elements) or null (for us age within formatter functions).

George

YUI Developer

Posted: 09/14/09
  • status changed from checkedin to closed

2.8.0 has been released. All "checkedin" items are available for download in the official release. Status of "checkedin" items is being set to closed.

George

YUI Developer

Posted: 09/14/09
  • resolution changed to fixed

Jenny Donnelly

YUI Developer

Posted: 09/20/10
  • milestone changed from 2.8.0
  • resolution changed from fixed
  • status changed from closed to reopened

Jenny Donnelly

YUI Developer

Posted: 09/20/10
  • browser changed from N/A to IE - All
  • milestone changed to 2.9.0
  • status changed from reopened to accepted
  • version changed from 2.7.0 to 2.8.1

getTdEl() from within formatter is breaking in IE due to TD.parentNode.parentNode.parentNode !== null. It is returning a document fragment.

Jenny Donnelly

YUI Developer

Posted: 02/26/11
  • resolution changed to fixed
  • status changed from accepted to closed

Not able to reproduce. Seems fixed in 2.8.0. If you are still seeing a problem w/2.8.0 build, please provide a repro case.