Hybrid View

  1. #1
    Ext User
    Join Date
    Jan 2009
    Posts
    4
    Vote Rating
    2
    outlawbt is on a distinguished road

      0  

    Default [Solved] How to get totalProperty value from JsonReader?

    [Solved] How to get totalProperty value from JsonReader?


    Hello, I want to know is is possible to get the value from totalProperty from the following code:

    Code:
    UsersDataStore = new Ext.data.Store({
            id: 'UsersDataStore',
            proxy: new Ext.data.HttpProxy({
                url: requestUrl,
                method: 'POST'
            }),
            baseParams: {
                task: 'LISTING', 
                param: 'ALL'
            }, 
            reader: new Ext.data.JsonReader({
                root: 'results',
                totalProperty: 'total',
                id: 'id'
            },
    .
    .
    .
    etc...
    I tried the following :
    Code:
    alert(UsersDataStore.reader.totalProperty)
    but i get "undefined" as result...

  2. #2
    Ext User
    Join Date
    Mar 2009
    Posts
    5
    Vote Rating
    0
    Capzilla is on a distinguished road

      0  

    Default


    reader isn't a public property. And I don't think totalProperty is one in DataReader. Try:

    UsersDataStore.getReader().getTotalProperty()

    (off the head, check the API to be sure)

  3. #3
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    6
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      1  

    Default


    I think you may be looking for: http://extjs.com/deploy/dev/docs/?cl...ember=jsonData

    Try:
    Code:
    var total = grid.store.reader.jsonData.total;
    And the "total" property within jsonData depends on how you configured totalProperty in the first place.

  4. #4
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    6
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      1  

    Default


    You don't state what you're really doing, but you may be looking for:
    Code:
    store.getTotalCount();

  5. #5
    Ext User
    Join Date
    Jan 2009
    Posts
    4
    Vote Rating
    2
    outlawbt is on a distinguished road

      2  

    Default


    Quote Originally Posted by mjlecomte View Post
    I think you may be looking for: http://extjs.com/deploy/dev/docs/?cl...ember=jsonData

    Try:
    Code:
    var total = grid.store.reader.jsonData.total;
    And the "total" property within jsonData depends on how you configured totalProperty in the first place.
    Yes, this has worked for me.. Thank you so much !

Thread Participants: 2