1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    7
    Vote Rating
    0
    kpavan304 is on a distinguished road

      0  

    Default Urgent: ComboBox In Grid

    Urgent: ComboBox In Grid


    Hi,

    I am trying to display following json into a grid.

    Code:
    {
        "name": "XYZ",
        "columns": [
            {
                "name": "FName",
                "conditions": [
                    {
                        "name": "Equals"
                    },
                    {
                        "name": "NotEquals"
                    }
                ]
            },
            {
                "name": "Salary",
                "conditions": [
                    {
                        "name": "Greater Than"
                    },
                    {
                        "name": "Lesser Than"
                    }
                ]
            }
        ]
    }
    I need grid columns as Name and Conditions.
    Conditions column to be a Combo Box with different values in each row i.e from conditions node.

    My Combox is displaying values as [object Object],[object Object].


    Please help me to resolve this issue.

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,154
    Vote Rating
    475
    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 will need to provided any information about your store/model/proxy. How are you populating your combo? Do you have another store for this data? You description is very vague.

    Scott.

  3. #3
    Sencha User
    Join Date
    Jan 2012
    Posts
    7
    Vote Rating
    0
    kpavan304 is on a distinguished road

      0  

    Default


    My Model:

    Ext.define('MyApp.model.Column', { extend: 'Ext.data.Model',


    fields: [
    {
    name: 'name'
    },
    {
    name: 'conditions'
    }
    ]
    });
    My Store:

    Ext.define('MyApp.store.MyJsonStore', {
    extend: 'Ext.data.Store',
    requires: [
    'MyApp.model.Column'
    ],


    constructor: function(cfg) {
    var me = this;
    cfg = cfg || {};
    me.callParent([Ext.apply({
    autoLoad: true,
    storeId: 'MyJsonStore',
    model: 'MyApp.model.Column',
    proxy: {
    type: 'ajax',
    url: 'http://localhost/dataStores/config.json',
    reader: {
    type: 'json',
    root: 'columns'
    }
    }
    }, cfg)]);
    }
    });
    My Grid Panel:

    Ext.define('MyApp.view.MyPanel', {
    extend: 'Ext.panel.Panel',


    height: 335,
    width: 558,
    autoScroll: true,
    title: 'My Panel',


    initComponent: function() {
    var me = this;


    Ext.applyIf(me, {
    items: [
    {
    xtype: 'gridpanel',
    autoRender: false,
    autoScroll: true,
    title: 'My Grid Panel',
    store: 'MyJsonStore',
    viewConfig: {


    },
    selModel: Ext.create('Ext.selection.CellModel', {


    }),
    plugins: [
    Ext.create('Ext.grid.plugin.CellEditing', {
    ptype: 'cellediting',
    clicksToEdit: 1
    })
    ],
    columns: [
    {
    xtype: 'gridcolumn',
    dataIndex: 'name',
    text: 'Name'
    },
    {
    xtype: 'gridcolumn',
    dataIndex: 'conditions',
    text: 'Conditions'
    }
    ]
    }
    ]
    });


    me.callParent(arguments);
    }


    });

  4. #4
    Sencha User
    Join Date
    Jan 2012
    Posts
    7
    Vote Rating
    0
    kpavan304 is on a distinguished road

      0  

    Default


    Any suggestions..this is taking so long.....

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    57
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    See examples/grid/cell-editing.html in your SDK for an example.

  6. #6
    Sencha User
    Join Date
    Jan 2012
    Posts
    7
    Vote Rating
    0
    kpavan304 is on a distinguished road

      0  

    Default


    My JSON is


    { "name": "XYZ", "columns": [ { "name": "FName", "conditions": [ { "name": "Equals" }, { "name": "NotEquals" } ] }, { "name": "Salary", "conditions": [ { "name": "Greater Than" }, { "name": "Lesser Than" } ] } ]}
    Placing an editor in the "Conditions" column with xtype as combobox is not working.

    how can i pass Arraylist of a gridcolumn to combobox editor of that column.

Thread Participants: 2

Tags for this Thread