PDA

View Full Version : 3.3.1 GridPanel + RowEditor bug



raj_plays
21 Feb 2011, 3:16 AM
Hi,
I upgraded to 3.3.1 from 3.1.1 and am facing a problem.
My GridPanel is configured with a Ext.ux.grid.RowEditor plugin.
When I try to add or edit a row, I get the following error:
"'undefined' is null or not an object" on the red line of the RowEditor source code


initFields: function(){
var cm = this.grid.getColumnModel(), pm = Ext.layout.ContainerLayout.prototype.parseMargins;
this.removeAll(false);
for(var i = 0, len = cm.getColumnCount(); i < len; i++){
var c = cm.getColumnAt(i),
ed = c.getEditor();
if(!ed){
ed = c.displayEditor || new Ext.form.DisplayField();
}else{
ed = ed.field;
}
if(i == 0){
ed.margins = pm('0 1 2 1');
} else if(i == len - 1){
ed.margins = pm('0 0 2 1');
} else{
ed.margins = pm('0 1 2');
}
ed.setWidth(cm.getColumnWidth(i));
ed.column = c;
if(ed.ownerCt !== this){
ed.on('focus', this.ensureVisible, this);
ed.on('specialkey', this.onKey, this);
}
this.insert(i, ed);
}
this.initialized = true;
},


The same code used to work with 3.1.1.
Please help fix this.

Condor
21 Feb 2011, 4:43 AM
How did you configure your columns? It looks like one of the editors is invalid.

ps. And did you upgrade/remove all Ext 3.1.1 overrides and extensions?

raj_plays
21 Feb 2011, 7:38 AM
Hi,
Here is my grid config... (I don't think the issue lies here)


var editor = new Ext.ux.grid.RowEditor({
saveText: 'Submit',
errorSummary: false
});
CampaignListingGrid = new Ext.grid.GridPanel({
id: 'CampaignListingGrid',
store: campaignDataStore,
columns: [{
header: "Name",
width: 200,
dataIndex: 'name',
sortable: true,
editor: {
xtype: 'textfield',
// rules about editing
allowBlank: false,
maxLength: 100,
maskRe: /([a-zA-Z0-9\s_()&,:]+)$/,
style: {
float: 'left'
}
},
align: 'left'
}, {
header: "Start Date",
width: 100,
dataIndex: 'start_date',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
sortable: true,
editor: {
xtype: 'datefield',
allowBlank: false,
maxLength: 10,
format: 'Y-m-d',
style: {
float: 'left'
}
},
align: 'left'
}, {
header: "End Date",
width: 100,
dataIndex: 'end_date',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
sortable: true,
editor: {
xtype: 'datefield',
allowBlank: false,
maxLength: 10,
format: 'Y-m-d',
style: {
float: 'left'
}
},
align: 'left'
}, {
header: "Remarks",
width: 260,
dataIndex: 'remarks',
sortable: true,
editor: {
xtype: 'textfield',
maxLength: 150,
maskRe: /([a-zA-Z0-9\s_()&,:]+)$/,
style: {
float: 'left'
}
},
align: 'left'
}],
enableColLock: false,
stripeRows: true,
clicksToEdit: 1,
selModel: new Ext.grid.RowSelectionModel({
singleSelect: true
}),
plugins: [editor],
.........
)};


I replaced the entire ext-3.1.1 folder in my application with the ext-3.3.1 folder.
Then I used..
<scriptlanguage="javascript"type="text/javascript"src="../Javascripts/ext-3.3.1/adapter/ext/ext-base.js"></script>
<scriptlanguage="javascript"type="text/javascript"src="../Javascripts/ext-3.3.1/ext-all.js"></script>
<scriptlanguage="javascript"type="text/javascript"src="../Javascripts/RowEditor.js"></script>

I Don't know about any overrides or extensions.

Condor
21 Feb 2011, 8:11 AM
Just to make sure, you are using the RowEditor that came with Ext 3.3.1 and not the one from Ext 3.1.1?

raj_plays
21 Feb 2011, 10:09 PM
That was it. Thank you, Condor.
So whenever I upgrade, I have to upgrade all ux files separately as well?