1. #1
    Ext User
    Join Date
    Aug 2009
    Posts
    7
    Vote Rating
    0
    jujubilation is on a distinguished road

      0  

    Default DirectStore and GridPanel -> I have to pay for the new version

    DirectStore and GridPanel -> I have to pay for the new version


    Hello,

    I spent a night try to fill a grid !
    In 5 minutes, I 'm able to have this to the client side (thanks to the ext-direct-pack) :

    Code:
    {"type":"rpc","result":{"classified": {"status":null,"name":"a","updated_at":"2009-04-29T11:21:48Z","display_address":null,"abstract":"a","estate_id":"1","end_announcement":null,"contact":null,"id":1,"owner_id":"1","start_announcement":null,"created_at":"2009-04-29T11:21:48Z"}},"status":true,"errors":[],"message":"Classifieds#index","tid":2}
    But impossible to fill the grid :

    Code:
            var store = new Ext.data.DirectStore({
              directFn: Classifieds.direct, // this function work !
              paramsAsHash: false,
              root: '',
              idProperty: 'id',
              fields: ['id', 'name']
            });
    
            var userColumns =  [
              {header: 'name', width: 160, sortable: true, dataIndex: 'name'},
              {id: 'id', header: 'id', width: 160, sortable: true, dataIndex: 'id'}
            ];
    
            var userGrid = new Ext.grid.GridPanel({
              renderTo: 'user-grid',
              title: 'Users',
              autoScroll: true,
              height: 300,
              store: store,
              columns : userColumns
            });
    
            store.load();
    I try all the examples, lots of threads and Google but impossible to find what's wrong.
    Someone can help me with this ? Thanks a lot for your help.

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,832
    Vote Rating
    609
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    1) Your root is empty.
    2) The idProperty doesn't match anything your data has returned.
    3) The id field you've specified don't match anything your data has returned.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Ext User
    Join Date
    Aug 2009
    Posts
    7
    Vote Rating
    0
    jujubilation is on a distinguished road

      0  

    Default


    Thanks a lot for your help. However I already test the grid with :
    Code:
    root: 'classified'
    And in my data, there is and id field (not in first position).

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    89
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    The root isn't 'classified'. It's 'result.classified', which is a lot better to see if you format the JSON data:
    Code:
    {
        "type": "rpc",
        "result": {
            "classified": {
                "status": null,
                "name": "a",
                "updated_at": "2009-04-29T11:21:48Z",
                "display_address": null,
                "abstract": "a",
                "estate_id": "1",
                "end_announcement": null,
                "contact": null,
                "id": 1,
                "owner_id": "1",
                "start_announcement": null,
                "created_at": "2009-04-29T11:21:48Z"
            }
        },
        "status": true,
        "errors": [],
        "message": "Classifieds#index",
        "tid": 2
    }

  5. #5
    Ext User
    Join Date
    Aug 2009
    Posts
    7
    Vote Rating
    0
    jujubilation is on a distinguished road

      0  

    Default


    Thanks Condor. sorry for this huge mistake. I changed the root but the result is the same : the grid is empty.
    My code :
    Code:
     var store = new Ext.data.DirectStore({
              directFn: Classifieds.direct,
              paramsAsHash: false,
              root: 'result.classified',
              fields: ['name']
            });
    
            var userColumns =  [
              {header: 'name', width: 160, sortable: true, dataIndex: 'name'},
            ];
    
            var userGrid = new Ext.grid.GridPanel({
              renderTo: 'user-grid',
              title: 'Users',
              autoScroll: true,
              height: 300,
              store: store,
              columns : userColumns
            });
    
            store.load();

  6. #6
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    89
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Which Ext version are you using? For older Ext versions the root needs to be an array, e.g.
    Code:
    {
        "type": "rpc",
        "result": {
            "classified": [{
                "status": null,
                "name": "a",
                "updated_at": "2009-04-29T11:21:48Z",
                "display_address": null,
                "abstract": "a",
                "estate_id": "1",
                "end_announcement": null,
                "contact": null,
                "id": 1,
                "owner_id": "1",
                "start_announcement": null,
                "created_at": "2009-04-29T11:21:48Z"
            }]
        },
        "status": true,
        "errors": [],
        "message": "Classifieds#index",
        "tid": 2
    }

  7. #7
    Ext User
    Join Date
    Aug 2009
    Posts
    7
    Vote Rating
    0
    jujubilation is on a distinguished road

      0  

    Default


    I'm using the latest version (3.0).

  8. #8
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    89
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    3.0 isn't a version. The latest version is 3.0.1 and I assume you are using 3.0.0?

  9. #9
    Ext User
    Join Date
    Aug 2009
    Posts
    7
    Vote Rating
    0
    jujubilation is on a distinguished road

      0  

    Default


    Yes, 3.0.0

  10. #10
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    89
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    In that case you'll need to convert your JSON data into an array (or upgrade to 3.0.1).

Thread Participants: 3

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi