Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Easy on Oct 20, 2008 05:15
open dhtmlx forum
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).
Answer posted by Support on Oct 20, 2008 07:46
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
});
Answer posted on Oct 20, 2008 09:01
I try but:

mygrid.editor.obj is null

any ideas?

Answer posted by Support on Oct 21, 2008 01:20
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
});
Answer posted on Oct 21, 2008 05:35
Yep, now works correctly

TNX!