PDA

View Full Version : Listener on Editor Grid Panel



Ourysso
25 Nov 2010, 3:48 AM
I have this grid in my code:


var grid_materiais = new Ext.grid.EditorGridPanel({
x: 10,
y: 185,
id: 'grid_materiais',
title: '<center>Materiais</center>',
frame: false,
border: true,
columnLines: true,
anchor: '-10px',
enableColumnMove: false,
enableHdMenu: false,
bodyStyle: 'border-color: #B5B8C8; padding: 0px;',
autoExpandColumn: "Material",
loadMask: true,
height:200,
clickstoEdit: 1,
store: storeMateriais,
cm: ColumnModel,
sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
listeners: {
specialkey: function(f,e){
if (e.getKey() == e.ENTER) {
saveGrid();
}
}
}
});


I wanna save the grid when the user press enter but the listener doesn't work.
Someone have any idea how I do that? (I wanna delete the line of the grid when the user press DEL in the keyboard too).
Thanks for the help.

Condor
25 Nov 2010, 6:49 AM
An editorgrid has 2 modes of operation:
1. When one of the editors is active, all special keys will be processed by the ColumnModel.
2. When no editor is active, you can catch special keys in the keydown/keypress event of by specifying 'keys'.

ps. EditorGridPanel does not have a 'specialkey' event.