2014-09-03 32 views
0

我想对数据动态更新dataTable的行计数

检索更新我的DataTable的row_count我创建一个空的DataTable,并使其myDiv

var dataTable = new Y.DataTable({ 
      columns: columns, 
      footerView: Y.FooterView, 
      footerConfig: { 
       fixed: true, 
       heading: { 
        colspan: 3, 
        content: "Number Records : {row_count} " 
       } 
      } 
     }).render("#myDiv"); 

上的一个按钮的点击,dataTable会被IO请求填充。

var node = Y.one('#searchButton'); 
node.on(
      'click', 
      function() { 
      dataSource = new Y.DataSource.IO({source:'mySource'}); 
      ... 
      //code to set data in dataTable 
      ... 
      size = dataTable.data.size(); //retrieves the number of records, but row_count in the footer of course remains '0' 

我怎么能动态地更新footerView 内容的 'ROW_COUNT',以反映大小

回答

0

渲染上“点击”的#searchButton获取的行数和表中显示出来我的表:

var node = Y.one('#searchButton'); 
node.on(
    ... 
    dataTable.render("#myDiv"); //renders the table to the Div, # of records and all