Results 1 to 5 of 5

Thread: Reset the paging params (start, page) on list render

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    26
    Vote Rating
    4
      1  

    Default Reset the paging params (start, page) on list render

    I have a category list and a product list. When the category list is clicked, a new panel with a list of products is displayed which is paged. When a back button is clicked back to categories, the product list is destroyed.

    I am finding that when another category is clicked and the product list loads, the list paging params are not being reset. The same store is being used, but the data is being cleared.

    Is there anyway to reset the paging params such as start and page?

    Code:
    this.list = new Ext.List({
    	store: 'LocalProductsStore',
    	plugins: [{
    		ptype: 'listpaging',
    		autoPaging: false
    	}],
    	singleSelection: true,
    	emptyText: '<p class="no-products">No products found matching this criteria.</p>',
    	itemTpl: atd.templates.ProductListItem,
    	listeners: {
    		selectionchange: {fn: this.onSelect, scope: this}
    	}
    });

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      1  

    Default

    loadPage(0) on the store.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    52
    Answers
    3
    Vote Rating
    0
      0  

    Default

    I think you meant to say loadPage(1)

  4. #4
    Sencha User
    Join Date
    Jul 2012
    Posts
    13
    Vote Rating
    1
      0  

    Default

    This unfortunately fires a new request.
    Is there no way like
    Code:
    Ext.getCmp("ListPaging").clearParams()
    or something?

  5. #5
    Sencha User
    Join Date
    Jul 2012
    Posts
    13
    Vote Rating
    1
      0  

    Default

    What I did is a bit hacky but works for now.

    I'm setting a store variable called needsReset to false and when I need to reset the params I obviously call
    Code:
    store.setNeedsReset(true)
    the in my stores' beforeload listener I check for that variable and if true I call store.loadPage(1), re-set my variable to false and return false;
    Code:
    if (store.getNeedsReset()){
        store.setNeedsReset(false);
        store.loadPage(1);
        return false;
    }
    This causes the proxy to stop loading the actual call and calles a new one with parameters for page 1.

    This is dirty and I need to digg through this again later...

Posting Permissions

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