具有TEXT responseType的YUI DataTable

时间:2013-03-19 03:59:48

标签: yui yui-datatable

  //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 DataSource使用TYPE_TEXT responseType。但是上面无法在YUI表列单元格中呈现数据。我也没有在JS控制台中看到任何错误。 我错过了什么?

1 个答案:

答案 0 :(得分:0)

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

更改了列定义以添加字段属性,它就可以实现......