1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    20
    Vote Rating
    0
    sirkis is on a distinguished road

      0  

    Default Answered: Load substore in a Grid

    Answered: Load substore in a Grid


    Hello

    I have an association in my store, i want to load subdata in a grid.

    My models
    Code:
    Ext.define('Zone', {
        extend: 'Ext.data.Model',
        fields: ['id', 'name'],
        hasMany  : {model: 'RefItemZone', name: 'refItems', associationKey:'refItems'}
    });
    
    Ext.define('RefItemZone', {
        extend: 'Ext.data.Model',
        fields: ['link'],
        belongsTo: 'Zone'
    });
    My grid
    Code:
    var grid = Ext.create('Ext.grid.Panel', {
            renderTo: document.body,
            plugins: [rowEditing],
            width: '100%',
            height: window.innerHeight,
            frame: true,
            title: 'Zones',
            store: store,
            collapsible: true,
            columns: [{
                text: 'ID',
                width: 40,
                sortable: true,
                dataIndex: 'id'
            }, {
                text: 'Nom',
                flex: 1,
                sortable: true,
                dataIndex: 'name',
                field: {
                    xtype: 'textfield'
                }
            },{
                text: 'Component',
                flex: 1,
                sortable: true,
                dataIndex: 'SOMETHING THERE',
                field: {
                    xtype: 'textfield'
                }
            }]
    });

    Thank for your help

  2. There are some in the docs for Column and grid.Panel (http://docs.sencha.com/ext-js/4-0/#!....column.Column)

    An other example:

    render: function(value, metaData, record) {
    return value + ' ' + record.get('anythingElse');
    }

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,791
    Answers
    3465
    Vote Rating
    833
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You cannot have two different stores on a grid. The only thing that you can do is when the hasMany store has data, update the record on the main store but that's messy.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    20
    Vote Rating
    0
    sirkis is on a distinguished road

      0  

    Default Store

    Store


    Ok but i have only one store with sub store in it.

    Code:
    var store = Ext.create('Ext.data.Store', {
            autoLoad: true,
            autoSync: true,
            sorters: 'id',
            groupField: 'name',
            model: 'Zone',
            proxy: {
                type: 'rest',
                url: '/rest/zones',
                reader: {
                    type: 'json'
                },
                writer: {
                    type: 'json'
                }
            }
        });

    Capture-1.png

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,791
    Answers
    3465
    Vote Rating
    833
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    I see... you will need to use a renderer in that case. dataIndex should be the first level key in the record.data Object and then the renderer, the first argument will be the value of that key... you can then traverse down that and return what you want to be displayed. If you need something included in the record, the record is passed as the 3rd argument i believe.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  6. #5
    Sencha User
    Join Date
    Oct 2011
    Posts
    20
    Vote Rating
    0
    sirkis is on a distinguished road

      0  

    Default


    Ok Thanks !

    Do you have an example of this ?

  7. #6
    Sencha User
    Join Date
    Dec 2009
    Location
    Enschede, The Netherlands
    Posts
    327
    Answers
    16
    Vote Rating
    13
    flanders will become famous soon enough

      0  

    Default


    There are some in the docs for Column and grid.Panel (http://docs.sencha.com/ext-js/4-0/#!....column.Column)

    An other example:

    render: function(value, metaData, record) {
    return value + ' ' + record.get('anythingElse');
    }

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