0
  //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 控制台中看到任何错误。我错过了什么?

4

1 回答 1

0
 var column = new YAHOO.widget.Column(colObjConfig);
 column.field = ""+i+"";
 myColumnDefs.push (column );

更改了列定义以添加字段属性,它成功了......

于 2013-03-19T13:35:08.360 回答