YUILibrary - Open source JavaScript and CSS for building richly interactive software.
Fork YUI on GitHub

YUI 2.x

Ticket #2528627 (checkedin defect)

Reporter


michael mifsud
Opened: 11/14/09
Last modified: 11/16/09
Status: checkedin
Type: defect

Owner


Jenny Han Donnelly
Target Release: 2.NEXT
Priority: P3 (normal)
Summary: YAHOO.widget.ScrollingDataTable COLOR_COLUMNFILLER config causes error
Description:

Setting the COLOR_COLUMNFILLER config option when initialising the YAHOO.widget.ScrollingDataTable causes a javascript error.

This happens in 2.8.0r4.

Type: defect Observed in Version: 2.8.0
Component: DataTable Severity: S3 (normal)
Assigned To: Jenny Han Donnelly Target Release: 2.NEXT
Location: Library Code Priority: P3 (normal)
Tags: DataTable, ScrollingDataTable , COLOR_COLUMNFILLER Relates To:
Browsers: N/A
URL:
Test Information:

HTML:


<!-- YUI Includes //-->
<link rel="stylesheet" type="text/css" media="screen" href="http://yui.yahooapis.com/combo?2.8.0r4/build/button/assets/skins/sam/button.css&2.8.0r4/build/datatable/assets/skins/sam/datatable.css" />
<script type="text/javascript"
src="http://yui.yahooapis.com/combo?2.8.0r4/build/yahoo-dom-event/yahoo-dom-event.js&2.8.0r4/build/element/element-min.js&2.8.0r4/build/button/button-min.js&2.8.0r4/build/datasource/datasource-min.js&
2.8.0r4/build/datatable/datatable-min.js"></script>

<!-- My Includes //-->
<script type="text/javascript" src="/js/a.js"></script>

....
<div id="basic" class="yui-skin-sam"></div>

/js/a.js


YAHOO.example.Data = {
bookorders: [
{address:"po-0167", suburb:new Date(1980, 2, 24), quantity:1, amount:4, title:"A Book About Nothing"},
{address:"po-0783", suburb:new Date("January 3, 1983"), quantity:null, amount:12.12345, title:"The Meaning of Life"},
{address:"po-0297", suburb:new Date(1978, 11, 12), quantity:12, amount:1.25, title:"This Book Was Meant to Be Read Aloud"},
{address:"po-1482", suburb:new Date("March 11, 1985"), quantity:6, amount:3.5, title:"Read Me Twice"},
{address:"po-0167", suburb:new Date(1980, 2, 24), quantity:1, amount:4, title:"A Book About Nothing"},
{address:"po-0783", suburb:new Date("January 3, 1983"), quantity:null, amount:12.12345, title:"The Meaning of Life"},
{address:"po-0297", suburb:new Date(1978, 11, 12), quantity:12, amount:1.25, title:"This Book Was Meant to Be Read Aloud"},
{address:"po-1482", suburb:new Date("March 11, 1985"), quantity:6, amount:3.5, title:"Read Me Twice"},
{address:"po-0167", suburb:new Date(1980, 2, 24), quantity:1, amount:4, title:"A Book About Nothing"},
{address:"po-0783", suburb:new Date("January 3, 1983"), quantity:null, amount:12.12345, title:"The Meaning of Life"},
{address:"po-0297", suburb:new Date(1978, 11, 12), quantity:12, amount:1.25, title:"This Book Was Meant to Be Read Aloud"},
{address:"po-1482", suburb:new Date("March 11, 1985"), quantity:6, amount:3.5, title:"Read Me Twice"}
]
};

YAHOO.util.Event.addListener(window, "load", function() {
YAHOO.example.Scrolling = function() {

var myColumnDefs = [
{key:"address", sortable:true, resizeable:true, width:200},
{key:"suburb", formatter:YAHOO.widget.DataTable.formatDate, sortable:true, sortOptions:{defaultDir:YAHOO.widget.DataTable.CLASS_DESC},resizeable:true},
{key:"quantity", formatter:YAHOO.widget.DataTable.formatNumber, sortable:true, resizeable:true},
{key:"amount", formatter:YAHOO.widget.DataTable.formatCurrency, sortable:true, resizeable:true},
{key:"title", sortable:true, resizeable:true}
];

var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.bookorders);
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
myDataSource.responseSchema = {
fields: ["address","suburb","quantity","amount","title"]
};

var myDataTable = new YAHOO.widget.ScrollingDataTable("basic", myColumnDefs,
myDataSource, {height:"100%", COLOR_COLUMNFILLER:"red"});

return {
oDS: myDataSource,
oDT: myDataTable
};
}();
});

I managed to fix the bug locally by changing the following in datatable/datatable.js

before:


this.setAttributeConfig("COLOR_COLUMNFILLER", {
value: "#F2F2F2",
validator: lang.isString,
method: function(oParam) {
this._elHdContainer.style.backgroundColor = oParam;
}
});

after:


this.setAttributeConfig("COLOR_COLUMNFILLER", {
value: "#F2F2F2",
validator: lang.isString,
method: function(oParam) {
if(this._elHdContainer && this._elBdContainer) {
this._elHdContainer.style.backgroundColor = oParam;
}
}
});

Change History

michael mifsud

Posted: 11/14/09

quick note, either setting the COLOR_CULUMNFILLER property as the color string "red", or the hex color code "#ff0000" causes the same error.

Jenny Han Donnelly

YUI Developer

Posted: 11/16/09
  • browser changed from Firefox 3.x - PC,IE 7.x to N/A
  • location changed to Library Code
  • milestone changed to 2.NEXT
  • priority changed to P3 (normal)
  • status changed from new to checkedin

created e538055: "[fix bug #2528627] JS error when setting COLOR_COLUMNFILLER in constructor config."

In the meantime, the workaround is to set the color immediately after the constructor:
myDataTable.set("COLOR_COLUMNFILLER", "red");

Jenny Han Donnelly

YUI Developer

Posted: 11/16/09

[fix bug #2528627] JS error when setting COLOR_COLUMNFILLER in constructor config.
View Commit: 208cd5f05dae9c6767701a148e3c08b9ca1803f6