当我填满雅虎桌时,为什么我会两次分页

时间:2011-03-31 19:21:14

标签: javascript yui

为什么在填写雅虎桌时我会分页两次?我在填写之前删除了我的雅虎表。我只想告诉你,该表填写了正确的数据。

var MedicalFilesTable = document.getElementById('MedicalFilesTable');     
if(MedicalFilesTable.hasChildNodes())
{
   while(MedicalFilesTable.childNodes.length >= 1)
   {
      MedicalFilesTable.removeChild(MedicalFilesTable.firstChild);       
   }
}

YAHOO.example.MedicalFilesTable = function()
{
   var MyColumnDefs = [           
   {key:"eventid", label: "Event Id",sortable:true,formatter: YAHOO.widget.DataTable.formatAxsOppLink},   
   {key:"PartOfAMulti", label: "Multi?",sortable:true,formatter: YAHOO.widget.DataTable.formatAxsOppLink}                           
   ];

   var MyDataSource = new YAHOO.util.DataSource(gMedicalFilesArray);
   MyDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
   MyDataSource.responseSchema = {fields: ["eventid","PartOfAMulti"]};                           

   var MyConfigs = {paginator : new YAHOO.widget.Paginator({rowsPerPage: 10})};                           
   var MyDataTable = new YAHOO.widget.DataTable("MedicalFilesTable", MyColumnDefs, MyDataSource,MyConfigs);    

   return {oDS: MyDataSource, oDT: MyDataTable};
}(); 

1 个答案:

答案 0 :(得分:0)

分页可能不是子节点,而是生成到DOM的另一个对象/属性。尝试用新的DOM对象替换“MedicalFilesTable”。

尝试重置paginator对象..比如

var MyConfigs = {};
MyConfigs = {paginator : new YAHOO.widget.Paginator({rowsPerPage: 10})};