PDA

View Full Version : The same lookup store of different columns



Denin2004
18 Apr 2012, 3:44 AM
Hello!
I declare class:


Ext.define('MyLib.view.myComboBoxField' ,{
extend: 'Ext.grid.column.Column',
alias: 'widget.myComboBoxField',
renderField: '',
storeName: '',
displayField: '',
valueField: '',
gridID:'',
afterChange: false,
alwaysReloadStore: false,
renderer: myComboBoxFieldRenderer,
editor:{xtype: 'combobox',
typeAhead: true,
triggerAction: 'all',
selectOnTab: true,
allowBlank: false,
listeners:{'change':myComboBoxFieldEditorChange}},
initComponent: myComboBoxFieldInit
});

function myComboBoxFieldInit()
{
this.editor.displayField = this.displayField;
this.editor.valueField = this.valueField;
this.editor.thisField = this;
this.editor.store = Ext.create(this.storeName);
if(this.alwaysReloadStore)this.editor.listeners['beforequery'] = function(qe){delete qe.combo.lastQuery;};
this.gridObject = Ext.getCmp(this.gridID);
this.callParent();
}


I have init code:


"columns":[{"header": "Наименование типа",
"xtype": "myComboBoxField",
"dataIndex": "fld6",
"width": 250,
"storeName": "UsersApp.store.lookGoodParams",
"displayField": "fld7",
"renderField": "fld7",
"valueField": "fld6",
"gridID":"gridGoodParams",
"afterChange": function(field,newValue,oldValue){if(newValue != '')Ext.getCmp('gridGoodParams').cd6 = newValue;}
},
{"header":"Значение",
"xtype": "myComboBoxField",
"dataIndex":"fld8",
"width":250,
"storeName": "UsersApp.store.lookGoodParamValues",
"displayField": "fld9",
"renderField": "fld9",
"valueField": "fld8",
"gridID":"gridGoodParams",
"alwaysReloadStore": true}
]


Then call initComponent of my class at the second time "this.editor" already created and
editor.store became the same for my all objects .
How make editor.store different for all columns?

Thank you, Denis.

mitchellsimoens
18 Apr 2012, 12:25 PM
You should have the editor config on each column

Denin2004
18 Apr 2012, 12:40 PM
Thanks, I already solved this problem by
remove editor:{...} from define class and generate it in initComponent manualy.