How to select cell content on edit?

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).

1 Like
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
});

I try but:

mygrid.editor.obj is null

any ideas?

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
});

Yep, now works correctly

TNX!