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

问题描述 投票:0回答:1

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

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

你能帮我解决一下我还缺少什么吗?

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();
}
extjs coldfusion extjs4 extjs4.2 coldfusion-2018
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
});

}

© www.soinside.com 2019 - 2024. All rights reserved.