Rank: Newbie Groups: Member
Joined: 5/25/2010 Posts: 4
|
Hi eo_support,
When I set FullRowMode is False in Grid, it will automatically append a new row in the bottom of the grid, Can I assign default value for the new row?
One more question, if it's possible to assign default value, can I assign a dynamic default value? like current datetime.
Thanks!
Felix
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, Yes. You can do that. You will need to set the column's ClientSideBeginEdit to a function that handles whatever logic when the cell enters edit mode. It will be something like this:
Code: HTML/ASPX
<eo:Grid .....>
.....
<Columns>
.....
<eo:TextBoxColumn ClientSideBeginEdit="begin_edit_handler" ....>
</eo:TextBoxColumn>
.....
</Columns>
.....
</eo:Grid>
Code: JavaScript
//This function is called before the cell enters edit mode
function begin_edit_handler(cell)
{
//Check whether the cell already has a value, if it
//doesn't, then set a default value
if (!cell.getValue())
cell.setValue("Change this!");
.....
}
Note the function is called when any cell for the column enters edit mode. So it doesn't matter whether you are adding a new row or editing an existing row. Thanks!
|
Rank: Newbie Groups: Member
Joined: 5/25/2010 Posts: 4
|
Hi, you solved my problems! Thank you so much!!
|