paginationgridextjs4

How to find current page number in EXTJS4 grid


I have an EXTJS paging grid with checkbox selection model. I want to know what page user is currently viewing.

I believe I can find the current page number if I can get the instance of pagingtoolbar.

I am adding code for my grid.

var searchGrid = Ext.create('Ext.grid.Panel', {
width: 430,
height: 200,
selModel: sm,
title: 'Search Results',
autoScroll: true,
scroll:'vertical',
store: gridStore,
loadMask: true,
viewConfig: {
    id: 'gv',
    trackOver: false,
    stripeRows: false
   }, columns:[  
   {
   text: "Link name",
    dataIndex: 'name',
    width: 200,
    align: 'left',
    sortable: true
}], 
},
dockedItems: [{
    xtype: 'pagingtoolbar',
    store: gridStore,   // same store GridPanel is using
    dock: 'bottom',
    displayInfo: true,
    listeners:{

        change : function( paging, pageData, options ){
            for(var i=0;i<selectedRows.length;i++){
                var record = searchGrid.store.getById(selectedRows[i]);
                if(record)
                searchGrid.getSelectionModel().select(record,true,false);
            }
            return true;    
        }
    }
}]

});


Solution

  • You can get that from gridStore.currentPage.