0
votes

I'm using Extjs 4.2 and am currently using the RowEditing plugin on a gridpanel so the user can edit records in the grid. The editor xtype for a given column needs to be 'textfield' for all but one record. It has to be a combobox editor for the other record. How do I implement this?

It almost sounds like a need a custom editor but I haven't seen many examples of that and certainly, no example that switches editor types for a column based on record information. the use of property.Grid ALMOST seems like the solution I need, except I'm looking at the same key for multiple records and I don't think that's what property.Grid is meant for.

A solution or any useful help is appreciated. Thanks.

2

2 Answers

0
votes

You need 2 editors, one for textfield, one for combo, and utility function that will determine and return the correct editor based on record value. The utility function would then be bound to your column's http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.grid.column.Column-method-getEditor method.

More info here: https://stackoverflow.com/a/7026075/1038593 Also check: http://www.sencha.com/forum/showthread.php?139440-changing-columnEditor-per-row-basis&p=637831&viewfull=1#post637831

0
votes

Is this instead, the right approach to take:

plugins: [
            Ext.create('Ext.grid.plugin.RowEditing', {
                clicksToEdit: 1,
                listeners: {
                    beforeedit : function(editor, context, eOpts){
                        if (context.record.getData().aliasName == 'document' && context.column.dataIndex == 'value')
                            //setEditor to combobox with column.setEditor()
                        else
                           //setEditor to textfield with column.setEditor()
                    }
                }
            })
],