Results 1 to 5 of 5

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

  1. #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 Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448
    Answers
    3997

    Default

    loadPage(0) on the store.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

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

    Default

    I think you meant to say loadPage(1)

  4. #4
    Sencha User
    Join Date
    Jul 2012
    Posts
    13

    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

    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
  •