1. #1
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    5
    Vote Rating
    0
    lab-24 is on a distinguished road

      0  

    Default JSON Nested List to Checkbox

    JSON Nested List to Checkbox


    HI,

    Is it possible to bind a nested array (the Roles in the following JSON) to checkboxes in a fieldset?

    [
    {
    "name": "User 1",
    "role": ["admin", "user", "partner"],
    },
    {
    "name": "User 2",
    "role": ["admin"],
    }
    ]

    Roles:
    [ ] superuser
    [x] admin
    [x] user
    [x] partner

    Regards,
    Marcel

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,912
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    You could create an ArrayStore and then use combo.store.loadData() to load the data.

    Regards,
    Scott.

  3. #3
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,895
    Vote Rating
    176
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    Check out setValue for checkboxgroup:
    http://docs.sencha.com/ext-js/4-0/#!...ethod-setValue

    Code:
    var form = ​Ext.widget('form', {
        width: 400
        , renderTo: Ext.getBody()
        , items: [{
            xtype: 'checkboxgroup'
            , defaults: { name: 'role' }
            , items: [{
                boxLabel: 'Superuser'
                , inputValue: 'superuser'
            }, {
                boxLabel: 'Admin'
                , inputValue: 'admin'
            }, {
                boxLabel: 'User'
                , inputValue: 'user'
            }, {
                boxLabel: 'Partner'
                , inputValue: 'partner'
            }]       
        }]
    });
    
    
    Ext.widget('button', {
        text: 'Set Values'
        , renderTo: Ext.getBody()
        , handler: function () {
            var boxes = form.down('checkboxgroup');
            var data = [{"name": "User 1","role": ["admin","user","partner"]},{"name": "User 2","role": ["admin"]}];
            boxes.setValue(data[0]);
        }
    });
    ​

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