Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    23
    Vote Rating
    6
    Razr is on a distinguished road

      0  

    Default TreeStore/Proxy not reading 'total' property

    TreeStore/Proxy not reading 'total' property


    When trying to have a NestedList with the ListPaging plugin working nicely, I came across an issue where the total property of the data is not parsed correctly?

    I return JSON from a server, which has the total set. But when logging some values from the ListPlugin I see those values:

    Code:
    store.getTotalCount(): null
    store.currentPage: 1
    store.getPageSize(): 24
    storeFullyLoaded: false
    In my TreeStore I only have a proxy with a type (ajax) and url defined. Since 'total' is an expected field if I'm not mistaken. I tried to create a fiddle:

    http://new.senchafiddle.com/#/tXpzF/

    If you run that fiddle and attempt to scroll the list you will see that the page is reloaded while total: 2 is specified in the data. How come the paging plugin still attempts to load another page?

    Workaround

    You can use the load event (in your TreeStore) and set the property yourself:
    Code:
    listeners: {
        load: function(store, records, success, operation) {                
             store.setTotalCount(records.length);
        }
    },

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,643
    Vote Rating
    816
    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

      0  

    Default


    I see you are doing a few things outside the framework. What I mean is you are specifying a store in the listConfig but what happens here is the list is given a store from the TreeStore called a NodeStore which will break since you are assigning it a treeStore. Furthermore there isn't anything here that will tell it to read the total.
    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
    Jul 2012
    Posts
    23
    Vote Rating
    6
    Razr is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    I see you are doing a few things outside the framework. What I mean is you are specifying a store in the listConfig but what happens here is the list is given a store from the TreeStore called a NodeStore which will break since you are assigning it a treeStore. Furthermore there isn't anything here that will tell it to read the total.
    So what do I have to assign in the listConfig then? And how can I 'tell it' to read the total? I would appreciate it if you can point me a bit more in the right direction. The documentation is also not very helpfull.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,643
    Vote Rating
    816
    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

      0  

    Default


    I assume you are trying to use the total to get the ListPaging to work? The ListPaging plugin won't work for NestedList, you will need to use something different to accomplish this. To get the total to be read, you can use your own Model and have the total field, it won't work the same as using a regular store, it'll be a field not accessible via getTotalCount
    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.

Thread Participants: 1

Tags for this Thread