2013-03-19 191 views
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 DataSource使用TYPE_TEXT responseType。但是上述失败在YUI表格列单元格中呈现数据。我在JS控制台中也看不到任何错误。 我错过了什么?带有TEXT的YUI数据表responseType

回答

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

改变了列定义添加字段属性和它的伎俩......