0

I need to show all the records in the grid on clicking of the show all button on the paging toolbar docked at the bottom.

Tried adding load with param yet the grid will not refresh with all the records.

Can you help me with what else am i missing in this ?

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

Tried above but still no luck

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
    you have to update `pageSize` – Rohit Sharma Feb 07 '19 at 09:34
  • Tried this ds.pageSize=iCnt, only thing that changes is the displayMsg, but the grid would not refresh to show all items . – user9807332 Feb 07 '19 at 09:53
  • post a [fiddle](https://fiddle.sencha.com/#view/editor) for what you have tried so far. – Rohit Sharma Feb 07 '19 at 12:11
  • 1
    dose your ds.load fires the ajax request? and after what is the response from the back end look like? – Moataz Sanad Feb 08 '19 at 04:05
  • I finally figured it out that to update the bottom paging toolbar , the store pagesize was to be updated ds.pageSize=iCnt; And rightly pointed by Moataz my ajax request would be updated with just the pagesize or even ds.load({params:{start:0,limit:iCnt }}); start and limit wouldnt make a difference . Realized that in my case i had to updated my pagesize param ds.load({params:{pageSize:iCnt}}); – user9807332 Feb 08 '19 at 05:41
  • Someone should write up the solution as an "answer" ;-) – SOS Feb 12 '19 at 14:11

1 Answers1

0

Here is a JS solution I researched a few years back. There are a couple of references that I kept for in-line documentation.

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

}

Mike
  • 63
  • 6