Results 1 to 10 of 10

Thread: How to reset paging toolbar?

  1. #1
    Sencha Premium Member
    Join Date
    Oct 2010
    Posts
    98
    Answers
    5
    Vote Rating
    9
      0  

    Default Answered: How to reset paging toolbar?

    How can I reset paging toolbar when store is reloaded(most likely with different result set)? If user has changed to some other page start and page parameters reflects that. When user makes a new search naturally page should be first one...

  2. I tried loadPage but I couldn't set any parameters same way as in load method.

    I found this thread http://www.sencha.com/forum/showthre...-pagingtoolbar and succeeded by setting first myStore.currentPage = 1 and then calling myStore.load({... Feels little bit dirty though...

  3. #2
    Sencha User arthurakay's Avatar
    Join Date
    Sep 2008
    Location
    Antioch, IL
    Posts
    1,516
    Answers
    99
    Vote Rating
    77
      0  

    Default

    This usually happens automatically... post some code so I can see what you're doing and offer you a detailed answer.

  4. #3
    Sencha Premium Member
    Join Date
    Oct 2010
    Posts
    98
    Answers
    5
    Vote Rating
    9
      0  

    Default

    Code:
    myStore.load({
                params : {
                    
                    startDate: Ext.Date.format(myStartDate, 'd.m.Y'),
                    endDate: Ext.Date.format(myEndDate, 'd.m.Y'),
                    city: city
                },
                start: 0
    });
    Actually it seems to load first page correctly but the page number is not updated to field of paging toolbar.

  5. #4
    Sencha User arthurakay's Avatar
    Join Date
    Sep 2008
    Location
    Antioch, IL
    Posts
    1,516
    Answers
    99
    Vote Rating
    77
      0  

    Default

    Looking at the API docs for Ext.toolbar.Paging, it looks like you should have your "start" param inside the "params" object:

    PHP Code:
    store.load({
        
    params: {
            
    // specify params for the first page load if using paging
            
    start0,
            
    limitmyPageSize,
            
    // other params
            
    foo:   'bar'
        
    }
    }); 

  6. #5
    Sencha Premium Member
    Join Date
    Oct 2010
    Posts
    98
    Answers
    5
    Vote Rating
    9
      0  

    Default

    Quote Originally Posted by arthurakay View Post
    Looking at the API docs for Ext.toolbar.Paging, it looks like you should have your "start" param inside the "params" object:
    I tried and moved start=0 and limit=20 parameters to params object. But now I can see in firebug that request have parameters start=20 and limit=20. Is paging toolbar overriding start and limit parameters in params block?


    If I keep those parameters outside params object request has start=0 and limit=20 but paging toolbar is out of sync and shows page 2(or whatever page user has changed to before).

  7. #6
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,790
    Answers
    583
    Vote Rating
    391
      0  

    Default

    Don't think load() updates currentPage. Try:

    http://docs.sencha.com/ext-js/4-0/#!...ethod-loadPage

  8. #7
    Sencha Premium Member
    Join Date
    Oct 2010
    Posts
    98
    Answers
    5
    Vote Rating
    9
      1  

    Default

    I tried loadPage but I couldn't set any parameters same way as in load method.

    I found this thread http://www.sencha.com/forum/showthre...-pagingtoolbar and succeeded by setting first myStore.currentPage = 1 and then calling myStore.load({... Feels little bit dirty though...

  9. #8
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,790
    Answers
    583
    Vote Rating
    391
      0  

    Default

    Sorry about that, based my answer on the current online docs which are for version 4.0.6. It seems the second parameter for options wasn't added until after 4.0.2.

  10. #9
    Sencha Premium Member
    Join Date
    Oct 2010
    Posts
    98
    Answers
    5
    Vote Rating
    9
      0  

    Default

    Quote Originally Posted by skirtle View Post
    Sorry about that, based my answer on the current online docs which are for version 4.0.6. It seems the second parameter for options wasn't added until after 4.0.2.
    No problem. Thanks for helping!

  11. #10
    Sencha User
    Join Date
    Dec 2016
    Posts
    5
    Vote Rating
    0
      0  

    Default

    controller method code:
    store.removeAll();
    store.getProxy().extraParams = {
    target: target
    };
    this.getView().down('pagingtoolbar').moveFirst();

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •