PDA

View Full Version : Ext.form.ComboBox [this.store is null in ext-all-debug.js]



oddy
27 Aug 2009, 4:18 AM
Hi guys. Can you explain me what's wrong with my code?
I have a grid, a combobox as editor and lazyRender set to true.

My configuration for the combo is



var editorDomainFeed = {
xtype : "combo"
, lazyRender : true
, anchor : "100%"
, fieldLabel : "Active Feed"
, displayField : "name"
, editable : false
, forceSelection : true
, queryParam : "what"
, allQuery : "feeds"
, triggerAction : "all"
, mode : "remote"
, store : new Ext.data.JsonStore({
autoDestroy : false
, root : "records"
, totalProperty : "totalRecords"
, fields : ["name"]
, proxy : new Ext.data.HttpProxy({
api : {
read : {
method : "GET"
, url : domain_vocabulary_URI
}
}
})
})
};



And it used in a grid as



...
, colModel: new Ext.grid.ColumnModel({
defaults : {sortable : true}
, columns:[{
header: "Feed"
, dataIndex: "active_feed"
, width: 150
, editor: editorDomainFeed
, editable: true
}]
})
...


And it causes exception in ext-all-debug.js when I try to get the data for it.

Please, consider this example:
http://admin.fujiyama.yakuzadev.com/

login/password is admin/passw
Go to: Settings -> Domains and doubleclick on any cell in a Feed column. When you see a combo, try to expand it. It'l fail for some reason.

Condor
27 Aug 2009, 5:19 AM
An example using only these configs works correctly, so it must be something else you haven't posted.

Are you using the editorDomainFeed config object multiple times?

oddy
27 Aug 2009, 12:52 PM
An example using only these configs works correctly, so it must be something else you haven't posted.

Are you using the editorDomainFeed config object multiple times?
Only once. Actually, it's quite strange. When I use this combo in a window - all works fine, but using combo as an editor just doesn't work and I don't know why. I use Ext from the trunk.

oddy
28 Aug 2009, 12:31 AM
One more strange thing. Combobox as an editor is visible on a cell even if I change the focus. Condor, have you met that behavior before? What can cause this?

oddy
28 Aug 2009, 1:35 AM
I wrote a plugin which, at the end, does this:
colModel.setConfig(colModel.config, false);
:)

Condor
28 Aug 2009, 1:40 AM
Calling setConfig will destroy all editors in the current columnmodel!

oddy
28 Aug 2009, 2:50 AM
Calling setConfig will destroy all editors in the current columnmodel!
Yep. I already fixed that. But the question is why TextField editors were working. And why Comboboxes were not destroyed, but only "damaged"?

Condor
28 Aug 2009, 3:02 AM
That depends on how you 'fixed' the ColumnModel.

oddy
28 Aug 2009, 4:08 AM
That depends on how you 'fixed' the ColumnModel.
I just set second parameter to true for the setConfig method
Here's plugin source


Ext.namespace("Ext.ux.grid");
Ext.ux.grid.ColumnMarker = Ext.extend(Ext.util.Observable, {
/**
color
*/
headerTextColor: "#666"
, cellTextColor: "#484848"
, constructor : function(config) {
Ext.apply(this, config);
}
, init : function(grid) {
if ((grid instanceof Ext.grid.GridPanel) && (grid.colModel != undefined)){
this.grid = grid;

if (grid.rendered){
this.onRender();
} else {
grid.on({
scope: this
, single: true
, render: this.onRender
, reconfigure: this.onRender
});
}
}
}
, onRender: function(){
var colModel = this.grid.getColumnModel();
Ext.each(colModel.config, function(col){
if (col.editable === false || col.editor === undefined){
var header = String.format("<em style='color: {0}'>{1}</em>", this.headerTextColor, col.header);
var column = colModel.findColumnIndex(col.dataIndex);
colModel.setColumnHeader(column, header);

var style = String.format("color: {0};", this.cellTextColor);
col.css = col.css ? col.css + style : style;
}
}, this);
colModel.suspendEvents();
colModel.setConfig(colModel.config, true);
colModel.resumeEvents();
}
});
Ext.preg("gridcolumnmarker", Ext.ux.grid.ColumnMarker);