1. #1
    Sencha Premium Member
    Join Date
    Nov 2011
    Posts
    102
    Vote Rating
    1
    anarchos78 is on a distinguished road

      0  

    Default Answered: Dataviews misconception

    Answered: Dataviews misconception


    Hello to everyone,
    I have a problem loading data in dataview. When I am trying to load data in panel using a template and static data everything is fine follow the link in jsfiddle.net: http://jsfiddle.net/anarchos78/dbCxS/5/
    Now, I am trying to do the same by using model, store, template and dataview. Nothing happens (no data loaded). Notice that I want to do the same using a proxy. I had already tried it but nothing was loaded. Follow: http://jsfiddle.net/anarchos78/KWT7E/4/
    In the second attempt you can see in the jsfiddle link that I had commented out a store with a proxy. The server’s JSON output is:
    Code:
    {"children":[null,{"member":[{
    "cls":"file",
    "text":"Gida Katsikis",
    "id":2001,
    "leaf":true,
    "biog":"The domestic goat (Capra aegagrus hircus) is a subspecies of 
    goat domesticated from the wild goat of southwest Asia and Eastern Europe.}],"DATASET":1}
    ]}
    The proxy’s reader root is “member”.
    What am I doing wrong?
    Thank you in advance,
    Tom

  2. With your data structure, you should config your reader root with "children[1].member"
    Code:
         proxy: {
              type: 'ajax',
              url: 'http://localhost:8500/MVC/Book_Ledger/app/cf_scripts/Members.cfc?method=getAllMembers&id=1',
              reader: {
                  type: 'json',
                  root: "children[1].member"
              }
          }

  3. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    With your data structure, you should config your reader root with "children[1].member"
    Code:
         proxy: {
              type: 'ajax',
              url: 'http://localhost:8500/MVC/Book_Ledger/app/cf_scripts/Members.cfc?method=getAllMembers&id=1',
              reader: {
                  type: 'json',
                  root: "children[1].member"
              }
          }

  4. #3
    Sencha Premium Member
    Join Date
    Apr 2011
    Posts
    101
    Answers
    8
    Vote Rating
    3
    sskow200 is on a distinguished road

      0  

    Default You must tell the template where to start

    You must tell the template where to start


    Code:
    Ext.onReady(function() {
    
        Ext.define('MyModel', {
            extend: 'Ext.data.Model',
            fields: [
                {name: 'name', type: 'string'},
                {name: 'biog', type: 'string'}
            ],
            proxy: {
                type: 'memory',
                reader: {
                    type: 'json'                    
                }
            }
        });
    
        // Store with inline data
        Ext.define('MyStore', {
            extend: 'Ext.data.Store',
            model: 'MyModel',
            autoLoad: true,
            data: [{
                name: 'Paparas',
                biog: 'Sigoura einai enas paparakos'}]
        });
    
    
        Ext.define('MyView', {
            extend: 'Ext.view.View',
            store: Ext.create('MyStore'),
            autoShow: true,
            tpl: [
                '<tpl for=".">',
                '<span class="selector">',
                '<b>Name: </b>',
                '{name}',
                '<br/>',            
                '{biog}',
                '</span>',
                '</tpl>'
            ],
            itemSelector: 'span.selector',
            emptyText: 'No description available',
            prepareData: function(data) {            
                return data;
            }
        });
    
    
        var thePanel = new Ext.Panel({
            height: 500,
            renderTo: Ext.getBody(),
            title: 'My Panel',
            items: Ext.create('MyView')
        });
    
    });

  5. #4
    Sencha Premium Member
    Join Date
    Apr 2011
    Posts
    101
    Answers
    8
    Vote Rating
    3
    sskow200 is on a distinguished road

      0  

    Default


    Not sure if this link will work, but here is where I tested this....

    http://jsfiddle.net/KWT7E/6/

  6. #5
    Sencha Premium Member
    Join Date
    Nov 2011
    Posts
    102
    Vote Rating
    1
    anarchos78 is on a distinguished road

      0  

    Default


    Thank both of you (vietits and sskow). I marked vietits answer a best because this forum engine doesn't give the possibility to mark more that one answer as best, so i have chosen the first on the row. Thank you again.
    Tom

Thread Participants: 2

Tags for this Thread

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