-
7 Feb 2012 12:29 PM #1
Exception editing grid: Uncaught TypeError: Cannot read property 'viewIndex' of null
Exception editing grid: Uncaught TypeError: Cannot read property 'viewIndex' of null
REQUIRED INFORMATION
Ext version tested:- Ext 4.1.0 Beta 2
Browser versions tested against:- Chrome 16.0.912.77 m
Description:- Exception is thrown when attempting to edit a cell in an editable grid panel. Error occurs when I double-click in a cell to begin the edit.
The result that occurs instead:
Code:Uncaught TypeError: Cannot read property 'viewIndex' of null Ext.define.indexOf AbstractView.js:927 Ext.define.getEditingContext /ext/4/src/grid/plugin/Editing.js:445 Ext.define.startEdit /ext/4/src/grid/plugin/Editing.js:410 Base.implement.callParent ext-debug.js:5924 Ext.define.startEdit /ext/4/src/grid/plugin/RowEditing.js:117 Ext.define.startEditByClick /ext/4/src/grid/plugin/Editing.js:390 Base.implement.callParent ext-debug.js:5924 Ext.define.startEditByClick /ext/4/src/grid/plugin/RowEditing.js:239 fire ext-debug.js:12969 Ext.define.continueFireEvent Observable.js:282 Ext.define.fireEvent Observable.js:255 Ext.override.fireEvent EventBus.js:22 Ext.define.processItemEvent Table.js:759 Ext.define.processUIEvent View.js:472 Ext.define.handleEvent View.js:411 (anonymous function) wrap
Test Case:
Code:plugins: [ Ext.create('Ext.grid.plugin.RowEditing', { clicksToMoveEditor: 1, clicksToEdit: 2 }) ]
Operating System:- Windows 7 Ultimate
-
7 Feb 2012 12:37 PM #2
I might also mention that this exception is not thrown with version 4.0.7.
-
7 Feb 2012 12:53 PM #3
Can't reproduce this, please post a full test case.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
25 Mar 2012 8:47 AM #4
I' have the same error with this code
the error occurs with the linePHP Code:Ext.define('classes.organismes.grilleServeursGed', {
extend: 'Ext.grid.Panel',
alias: 'widget.grilleServeursGed',
stateful: false,
width:375,
height:160,
initComponent: function() {
var me=this;
MB_ajoutServeurGed= new Ext.Action({
text: 'Ajouter un serveur',
iconCls: 'btnAddServeurGed',
handler : function(){
me.getStore().add({destinataires: ''});
}
});
this.store=Ext.create('Ext.data.Store',{
fields:[{name:'serveur'}]
});
this.columns =[{
id:'serveurs',
header:'Serveurs',
sortable:true,
hideable:false,
dataIndex:'serveur',
flex: 1,
editor: {
xtype: 'textfield',
allowBlank: false
}
},{
xtype: 'actioncolumn',
width:30,
hideable: false,
sortable: false,
items:[{
icon:'../../ressources/img/delete.gif',
tooltip:'Supprimer le serveur',
handler: function(grid, rowIndex, colIndex) {
me.getStore().removeAt(rowIndex);
}
}]
}
],
this.plugins=[
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
})
],
this.tbar=[MB_ajoutServeurGed],
this.listeners={
edit: function(editor, e){
e.record.commit();
}
},
this.callParent(arguments);
}
});
Without Ext.grid.plugin.CellEditing it's OKPHP Code:me.getStore().removeAt(rowIndex);
I use extjs 4.1 RC1
-
25 Mar 2012 9:00 PM #5
It seems that ActionColumn does not play well with CellEditing.
As a workaround, try configuring your ActionColumn with
Code:editor: null
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
25 Mar 2012 10:23 PM #6
OK, maybe 50/50 here...
You are deleting the record in the Action handler.
And then the editing plugin carries on and looks up the clicked upon record in the Store to try to edit it.
It's no longer there...Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
26 Mar 2012 9:16 AM #7
thank you for the reply, I changed my code, I had a listener to Ext.grid.plugin.CellEditing
and in actioncolumn, removed handlerPHP Code:this.plugins=[
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1,
listeners:{
beforeedit: function(e, eOpts){
if(eOpts.colIdx==1){
me.getStore().removeAt(eOpts.rowIdx);
return(false);
}
}
}
})
],
No error
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-5707
in
4.1.


Reply With Quote