Welcome Guest Search | Active Topics | Sign In | Register

[Grid] set default value when FullRowMode is False Options
Felix Fong
Posted: Thursday, May 27, 2010 6:08:28 AM
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
eo_support
Posted: Thursday, May 27, 2010 9:05:58 AM
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!
Felix Fong
Posted: Thursday, May 27, 2010 11:46:58 PM
Rank: Newbie
Groups: Member

Joined: 5/25/2010
Posts: 4
Hi, you solved my problems! Thank you so much!!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.