Martin
Martin

Reputation: 4222

How to create editable grid column with few values? | Extjs

I have a grid with columns name, value, new value. New value column is combobox because there can be a few values. Admin can approve/decline new values and correct proposed these new values.

My grid columns looks like this:

columns: [
            { text: 'Name', dataIndex: 'property_name', width: 300 },
            { text: 'Value',  dataIndex: 'value', width: 350 },
            {
                text: 'New Value',
                dataIndex: 'new_value',
                width: 350,
                editor: { allowBlank: true },
                renderer: function(value, cell, record){
                    return record.get('new_value') == record.get('value') ? '' : record.get('new_value');
                }
            },
        ],

So is there a way to achive functionality a described above?

Upvotes: 0

Views: 401

Answers (1)

Alexander
Alexander

Reputation: 20224

The editor configuration takes any Ext.form.Field configuration (default is textfield), so for example:

editor:{
  xtype:'combobox', // <- this tells 
  store:'MyNewValueStore',
  forceSelection:true,
  queryMode:'local',
  ...
}

Upvotes: 2

Related Questions