首页 > 代码库 > yui--datatable 更新table数据

yui--datatable 更新table数据

更新datasource中_oData数据


var myTable = Map.realYUIDataTable;
var recordsSet = myTable.getRecordSet();
var records = recordsSet.getRecords();

for(var i=0; i<results.length; i++){
               vehicleid = results[i].VEHICLEID;     
               speed = results[i].SPEED;            
               gpsTime = results[i].GPSTIME;        
               longitude = results[i].LONGITUDE;        
               latitude = results[i].LATITUDE;        
               alarmStatus = results[i].ALARMSTATUS;
               onlineState = results[i].ISONLINE;    
               
               for(var k=0; k<records.length; k++){
                   var oData = http://www.mamicode.com/records[k]._oData;>if(alarmDispose(alarmStatus)){
                           oData.ALARMSTATUS =getAlarmStatusFromCode(alarmStatus);
                          }else{
                              oData.ALARMSTATUS ="";
                          }
                   }
               }
}

 

刷新表格行


var recordsSet = myTable.getRecordSet();
var records = recordsSet.getRecords();

var table_oData= http://www.mamicode.com/new Array();
   for(var x=0; x<records.length; x++){
   var oData = http://www.mamicode.com/records[x]._oData;> oData;
}
myTable.updateRows(0,table_oData);