1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    19
    Answers
    1
    Vote Rating
    0
    wxkevin is on a distinguished road

      0  

    Default Answered: Best Way to Model a List or Set of values

    Answered: Best Way to Model a List or Set of values


    What is the best way in Ext JS 4 to model a List or Set of String values returned from a REST call? I was trying to use a Model but that didn't work too well. I want to display a list of returned values in a Multiselect. Here is the returned JSON:

    {"theList":[{"value":"something1"},{"value":"something2"},{"value":"something3"}]}

    How would you create you model?

  2. Don't forget the "root" property in the reader.

    Code:
    Ext.define('MyModel', {
        extend: 'Ext.data.Model',
        fields: [
            {name: 'value',  type: 'string'}
        ],
        proxy: {
            type: 'rest',
            url : 'my.url',
            reader: {
                type: 'json',
                root : 'theList',
            }
        }
    
    });
    Good luck!

  3. #2
    Sencha Premium Member EPV's Avatar
    Join Date
    Dec 2010
    Location
    Sweden
    Posts
    175
    Answers
    23
    Vote Rating
    13
    EPV will become famous soon enough

      0  

    Default


    Don't forget the "root" property in the reader.

    Code:
    Ext.define('MyModel', {
        extend: 'Ext.data.Model',
        fields: [
            {name: 'value',  type: 'string'}
        ],
        proxy: {
            type: 'rest',
            url : 'my.url',
            reader: {
                type: 'json',
                root : 'theList',
            }
        }
    
    });
    Good luck!

  4. #3
    Sencha User
    Join Date
    Jan 2012
    Posts
    19
    Answers
    1
    Vote Rating
    0
    wxkevin is on a distinguished road

      0  

    Default


    Thanks. It worked.

Thread Participants: 1

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