|
Rank: Newbie Groups: Member
Joined: 1/13/2010 Posts: 4
|
When the user clicks in a field to edit it when FullRowMode="false" I want the contents of the field to be highlighted (so the user can just start typing and the old value will be overwritten).
Is this possible?
It looks like I should use ClientSideOnCellSelected() and then GetSelectedCell() to grab the cell and then just highlight it. But that last step is beyond me apparently.
Thanks Chris
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, Yes. ClientSideOnCellSelected is the correct way to go. You can use the following code:
Code: JavaScript
function select_cell(grid)
{
//Get the selected cell
var selectedCell = grid.getSelectedCell();
//Get the column index of the selected cell
var colIndex = selectedCell.getColIndex();
//Get the ID of the textbox used for that column. This line is
//the key because there is no public interface for you to access
//this textbox. Note this code is for TextBoxColumn only
var textBoxId = grid.getId() + "_c" + colIndex + "_edit_tb";
//Get the textbox used for that column. Note the Grid reuses
//the same editing UI for all rows. So there is only one textbox
//per column
var textBox = document.getElementById(textBoxId);
//Highlight the text in the textbox. The call is delayed with
//a timer so that the Grid can finishes updating its internal
//data first
setTimeout(function()
{
textBox.select();
}, 10);
}
Code: HTML/ASPX
<eo:Grid ClientSideOnCellSelected="select_cell" ....>
....
</eo:Grid>
Hope this helps. Please feel free to let us know if you have any question. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 1/13/2010 Posts: 4
|
Yep that did the trick. Thanks for the quick assistance.
|
|