动态更新dataTable Row Count

时间:2014-09-03 13:01:46

标签: javascript yui

我正在尝试在检索数据时更新我的​​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'以反映尺寸

1 个答案:

答案 0 :(得分:0)

点击'点击' #searchButton获取行数并在表中显示它们:

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