//Define the columns of the table
var myColumnDefs = new Array();
for ( i=0; i < $names.length ; i++)
{
var colObjConfig = new Object();
colObjConfig.label =$names[i];
colObjConfig.resizeable =true;
colObjConfig.width =150;
myColumnDefs.push ( new YAHOO.widget.Column(colObjConfig));
}
var beginningScoreRow = "1111,1111|1111,1111";
var myDataSource = new YAHOO.util.FunctionDataSource( function () {
return beginningScoreRow ;} );
myDataSource.responseType = YAHOO.util.DataSource.TYPE_TEXT;
myDataSource.responseSchema = {
fieldDelim : ",",
recordDelim : "|"
};
var myDataTable = new YAHOO.widget.DataTable("statusTable", myColumnDefs,
myDataSource);
我想对YUI数据源使用TYPE_TEXT responseType。但是上面的代码无法呈现YUI表列单元格中的数据。我在JS控制台也没有看到任何错误。我错过了什么?
var column = new YAHOO.widget.Column(colObjConfig);
column.field = ""+i+"";
myColumnDefs.push (column );
更改列定义以添加field属性,它成功了…