ONEditCell event

Hi

Iam using dhtmlgrid in my applacation.In my appliation i disabled backspace key by using function(function fnStopBackspaceKey() ).

whenever i want backspace key is working i called another function(function fnDeleteChar()).

The code that i used is written below



var deleteChar = false;

function fnStopBackspaceKey() {

if(event.keyCode == 8 && !(deleteChar)) {

event.returnValue = false;

}

deleteChar = false;

}

function fnDeleteChar() {

deleteChar = true;

}





I used above code for a textbox.As

<input type=“text” name=“searchText” value="< enter text to find >" onkeydown=“fnDeleteChar();”



It worked fine for that.Iwant to use the same function in grid also

So i wrote the code as below



mygrid.attachEvent(“onEditCell”,function(stage,id,ind,value){

if(stage==1){

fnDeleteChar();

return true;

}



if (stage==2) {

fnStopBackspaceKey();

}



return true;

})



But it is not working.Backspace is working only for a letter.

Please provide me solution.



Thanks

aalekhya

dhtmlxGrid catch “onKeyUp” event on the docement.body level, so it’s impossible to enable this event only for the grid.

The code which you are using can be modified to work with the grid.

function fnStopBackspaceKey() {
if (mygrid.editor) return true;
if(event.keyCode == 8 && !(deleteChar)) {


if you want it to be more flexible you can replace mygrid.editor with any global flag , which can be set from onEditCell event
( original code drop deleteChar flag after first key pressing, so you need to use some different global flag )