2015-03-13 56 views
0

我有當搜索表單提交創建合金UI DataTable - 該表顯示的記錄X量以及返回行計數不刷新

var dataTable = new Y.DataTable({ 
    columns: columns, 
    footerView: Y.FooterView, 
    scrollable: 'y', 
    height: '95%', 
    footerConfig: { 
     fixed: true, 
     heading: { 
      colspan: 5, 
      content: "Number of Records : {row_count}" //returns number of rows 
     } 
}); 

上提交的記錄數:

node.on(//search button 
'click', 
//make request 
success: function(e) { 
    //do some stuff 
    dataTable.set('data', responseText); //adds data to DataTable 
    //function to refresh {row_count}? 
} 

當搜索表單重新提交時,DataTable將被重新加載,但{row_count}不會刷新以匹配返回的記錄。在每次請求後有沒有簡單的方法來重新加載此計數?

回答

0

您可以在自己的

node.on(//search button 
'click', 
//make request 
success: function(e) { 

    var row_count = 0; 

    //do some stuff 
    dataTable.set('data', responseText); //adds data to DataTable 
    //function to refresh {row_count}? 
    row_count = dataTable.get('data').size(); 
    // something like this --> Y.one('#??').set('value',row_count); 


} 
計數這樣的行,並嘗試刷新{}的row_count與Y.one( '#??')。SET( '值',XYZ)