我需要添加一个按钮以显示网格中的所有记录

时间:2019-02-07 09:24:31

标签: extjs coldfusion extjs4 extjs4.2 coldfusion-2018

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

试图通过参数添加负载,但是网格不会刷新所有记录。

您能帮我解决我还想念的吗?

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();
}

1 个答案:

答案 0 :(得分: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
});

}