2014-09-03 35 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