0

单击停靠在底部的分页工具栏上的全部显示按钮时,我需要在网格中显示所有记录。

尝试使用参数添加负载,但网格不会刷新所有记录。

你能帮我解决我在这方面还缺少什么吗?

ds.load({params:{start:0,limit:iCnt }});

上面试过但仍然没有运气

grid.addDocked({
        xtype: 'pagingtoolbar',
        dock: 'bottom',
        pageSize: 50,  //maxRowCnt,//Pagesize set
        store: grid.getStore(),//Grid's store set
        displayInfo: true,//Display the records information
        displayMsg: 'Displaying Records {0} - {1} of {2}',
        emptyMsg: "No records to display",
        items: [
        {
            pressed: false,
            enableToggle:false,
            cls: 'x-btn-text',
            text: 'Show All',
            tooltipType: 'title',
            tooltip: ' Show all records ',
            handler:showAllFunc
        }]
    });


showAllFunc = function() {
    var grid = ColdFusion.Grid.getGridObject("mainGrid");
    var ds = grid.getStore();
    var iCnt = ds.getTotalCount();
    ds.load({params:{start:0,limit:iCnt }});
    grid.getView().refresh();
    grid.getDockedItems('toolbar[dock="bottom"]')[1].updateInfo();
}
4

1 回答 1

0

这是我几年前研究的一个 JS 解决方案。我为内联文档保留了一些参考资料。

//get the grid Object
grid = ColdFusion.Grid.getGridObject('myGrid'); //your grid name

//Call the function to add record count to the grid
gridFooter(grid);

//Modify grid footer to display record count
//See http://docs.sencha.com/ext-js/3-4/#!/api/Ext.PagingToolbar-cfg-prependButtons for more details.
var gridFooter = function()
{   //modified from 
//http://www.thecfguy.com/post.cfm/showing-record-information-in-cfgrid-footer-in-coldfusion-9

//overwrite existing grid footer with new div, Ext.id() will assign unique id to footer
var bbar = Ext.DomHelper.overwrite(grid.bbar,{tag:'div',id:Ext.id()},true);

//Create new PagingToolbar and render it to bbar (grid footer)
gbbar = new Ext.PagingToolbar({
    renderTo:bbar,
    store: grid.store, 
    pageSize: pgSize,
    displayMsg: 'Showing {0} - {1} out of {2} records',
    emptyMsg: '<b style="color:red">No Records Found</b>',
    displayInfo: true
});

}

于 2019-02-12T12:46:12.560 回答