Threaded View

  1. #1
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    80
    Answers
    3
    Vote Rating
    0
    fily55 is on a distinguished road

      0  

    Default Answered: Grid page number not changing after store.load

    Answered: Grid page number not changing after store.load


    Hi Guys,

    I have the following grid:

    Code:
     
    createSearchGrid    : function()    {
            var me = this,
            store = me.createStore(),
            columns    = me.createColumns(),
            paging = me.createPaging(store),
            topBar = me.createTopBar(),
            panel = Ext.create("Ext.grid.Panel",{
                title        : "Search",
                id            : "myGrid",
                columns     : columns,
                tbar        : topBar,
                dockedItems :  [paging],
                store       : store
            });
    The top bar looks like this:
    Code:
    createTopBar    : function(){
            var me = this,
            tbar = [],
            
            searchField    = {
                xtype        : "textfield",
                id            : "searchField"
            },
            
            searchBtn    = {
                xtype    : "button",
                text       : "Search"
                handler    : function(){
                    me.searchStore();
                }
            };
            
            tbar.push(searchField, searchBtn);
            
            return tbar;
        },
    And finally my searchStore function is as follows:
    Code:
    searchStore    : function(){
            var field = Ext.getCmp("searchField"),
            store = Ext.getCmp("myGrid").getStore(),
            value = field.getValue();
            store.load({params:{searchtext:value,page:1}});
        },
    When I refresh the store it all works fine. It loads with page param set to 1 but when the page number in the grid paging remains whatever it was last. Any ideas?

    I'm using extjs 4.1.3

  2. Never mind. When using the above method and using store.loadPage(1) when performing a search it all works fine. Hope this helps someone else as well, I find this to be pretty handy code.

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar