а

How to select cell content on edit?


#1

I would like to get cell content selected in edit mode, so when I type new value it will replace old one (instead adding to end of old value).


#2
It can be achieved by onEditCell event handler. You can try to use the following approach to select editor's content:
 
grid.attachEvent("onEditCell", function(stage,rowId,colIndex) {
 
    if(stage==1 && grid.editor.obj) 

        grid.editor.obj.select(); /* grid.editor.obj is the input object*/
 
    return true
});

#3

I try but:

mygrid.editor.obj is null

any ideas?


#4

Probably, there should be one more check:

grid.attachEvent(“onEditCell”,
function(stage,rowId,colIndex) {
 
    if(stage==1 && grid.editor && grid.editor.obj) 

        grid.editor.obj.select(); /* grid.editor.obj is the input object*/
 
    return true
});

#5

Yep, now works correctly

TNX!