1. #1
    Ext JS Premium Member
    Join Date
    Dec 2011
    Posts
    227
    Vote Rating
    2
    nicolabaldo is on a distinguished road

      0  

    Default nested json grid

    nested json grid


    I've this JSON.
    I need to set as dataindex the field "data.field_3.field_3a" in the column of a grid, but It doesn't work.






    "data":[{
    "field_1":1,
    "field_2":2,
    "field_3":{
    "field_3a":1,
    "field_3b":1
    }
    }]




    columns: [
    ...
    {
    xtype: 'gridcolumn',
    dataIndex: data.field_3.field_3a, ??????????
    editor: 'textfield',
    flex: 1,
    text: 'Cliente'
    }
    ...

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,910
    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


    See if the following will help:

    Code:
    Ext.onReady(function(){
    
        Ext.create('Ext.data.Store', {
            storeId:'simpsonsStore',
            fields:['name', 'email', 'change', 'extra.fielda'],
            autoLoad: true,
            proxy: {
                type: 'ajax',
                url: 'data.json',
                reader: {
                    type: 'json',
                    root: 'items'
                }
            }
        });
    
        Ext.create('Ext.grid.Panel', {
            title: 'Simpsons',
            store: Ext.data.StoreManager.lookup('simpsonsStore'),
            columns: [
                { header: 'Name',  dataIndex: 'name' },
                { header: 'Email', dataIndex: 'email', flex: 1 },
                { header: 'Change', dataIndex: 'change' },
                { header: 'Change', dataIndex: 'extra.fielda' }
            ],
            height: 200,
            width: 400,
            renderTo: Ext.getBody()
        }); 
    
    });
    Code:
    {
        'items': [
            {
                'name': 'Lisa',
                'email': 'lisa@simpsons.com',
                'change': 100,
                'extra': {
                	fielda: 'lisa-a',
                	fieldb: 'lisa-b'
                }
            },
            {
                'name': 'Bart',
                'email': 'bart@simpsons.com',
                'change': -20,
                'extra': {
                	fielda: 'bart-a',
                	fieldb: 'bart-b'
                }
            },
            {
                'name': 'Homer',
                'email': 'home@simpsons.com',
                'change': 23,
                'extra': {
                	fielda: 'homer-a',
                	fieldb: 'home-b'
                }
            },
            {
                'name': 'Marge',
                'email': 'marge@simpsons.com',
                'change': -11,
                'extra': {
                	fielda: 'marge-a',
                	fieldb: 'marge-b'
                }
            }
        ]
    }
    Regards,
    Scott.

  3. #3
    Ext JS Premium Member
    Join Date
    Dec 2011
    Posts
    227
    Vote Rating
    2
    nicolabaldo is on a distinguished road

      0  

    Default


    Thanks for reply. But I use the model.
    I try to use this as field:
    ...
    {
    mapping: 'extra.fielda',
    name: 'myFielda'
    }
    but It doesn't work.

Thread Participants: 1

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..."