1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    26
    Vote Rating
    2
    rossmurphy is on a distinguished road

      1  

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

    Unanswered: 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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,404
    Answers
    3549
    Vote Rating
    850
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      1  

    Default


    loadPage(0) on the store.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    48
    Answers
    3
    Vote Rating
    0
    celwell is on a distinguished road

      0  

    Default


    I think you meant to say loadPage(1)

  4. #4
    Sencha User
    Join Date
    Jul 2012
    Posts
    13
    Vote Rating
    1
    axeff is on a distinguished road

      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
    axeff is on a distinguished road

      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...