Welcome Guest Search | Active Topics | Sign In | Register

Data Grid - Column Edit Enabled/Disabled per row Options
SURFThru
Posted: Monday, October 25, 2010 10:42:11 AM
Rank: Newbie
Groups: Member

Joined: 10/25/2010
Posts: 2
I am creating a datagrid and want plan to use EO vs. the toolbox MSFT grid.

I have 5 columns in the grid. Based on a status for each column, it may be enabled or disabled for editing. I looked at the Excel style grid on the demo.

When using the Excel style (or another example that would work) I need to enable or disable a cell in row for editing based on a status in the database. I know I can get access at the row bind event.

In the case I am talking about lets say I have Row A and cells 1,2,3,4 can be edited, But on Row B only 2,3,4 can be edited because cell 1 needs to be disabled for editing. Is there an example I can look at for this item?
eo_support
Posted: Monday, October 25, 2010 10:49:46 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Yes. You can do that. The key is each column exposes a ClientSideBeginEdit JavaScript handler. You can handle that handler and then return false to cancel the edit. I don't think we have a sample for that, but it should be quite simple and straight forward:

Code: HTML/ASPX
<eo:Grid .....>
    ....
    <Columns>
        ....
        <eo:TextBoxColumn  
            ClientSideBeginEdit="begin_edit_handler" .....   />
        ....
    </Columns>
    ....
</eo:Grid>


Code: JavaScript
function begin_edit_handler(cell)
{
    if (cell.getValue() == "---")
        return false;
}


The above code checks whether the cell content is "---" and if it is, then do not allow user to edit it. You can modify that logic to anything that fits your need. The single argument passed to the handler is a client side GridCell object. You can use it to get other objects such as GridItem or Grid. You can find more details about our client side API at here:

http://doc.essentialobjects.com/library/1/clientapi_howto.aspx

Hope this helps. Please feel free to let us know if you have any more questions.

Thanks!
SURFThru
Posted: Wednesday, October 27, 2010 4:21:59 PM
Rank: Newbie
Groups: Member

Joined: 10/25/2010
Posts: 2
Wonderful!!!

Your support team is the best!!!!


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.