|
Rank: Advanced Member Groups: Member
Joined: 9/14/2009 Posts: 29
|
Good afternoon,
I am currently developing using the EO web grid control version 8.0 (2010) and wanted to, via client side code, be able to set a column to read only within a particular item row based on an after cell edit event. I noticed that the server version of GridColumn has a ReadOnly property but I did not see in your help documentation a set function to do accomplish this using the client side version of this object.
Is there any way to do this via client side code and, if so, how can this be done?
Thank you very much in advance,
Tom
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You will need to handle the GridColumn's ClientSideBeginEdit and return false from your handler. It will be something like this:
Code: HTML/ASPX
<eo:Grid ....>
....
<Columns>
....
<eo:TextBoxColumn ClientSideBeginEdit="begin_edit_handler" .... />
....
</Columns>
....
</eo:Grid>
Code: JavaScript
function begin_edit_handler(cell)
{
//based on whatever logic your application uses to return
//false from here to cancel the edit. For example, the following
//code does not allow edit if the cell text is "N/A"
if (cell.getValue() == "N/A")
return false;
}
Hope this helps. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 3/9/2012 Posts: 4
|
is there a way to test content of another cell in this row?
i am trying to figure it out for a days without success... i tried to turn the cell invisible and it works, but this only works when the cell is a checkbox, if the cell is a textbox, the edit event begins... :(
i used this to make a cell invisible: .hide_checkbox { display:none; }
i am using a developer license. thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
For textbox, you will need to handle the Columns' ClientSideBeginEdit and return false from your handler to prevent the cell from enter edit mode.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 3/9/2012 Posts: 4
|
ok it is done. I was trying ClientSideBegiEdit without success, but i tried this code and it is working!!! uhuuuuuuuu!! :)
function BeginEdit(cell) { var item = cell.getItem(); if (item.getCell(10).getValue() != "") return false; // not allowed to edit }
edited: ================================================== last question: as you can see, i get value of another cell using cell index, is there a easy way to get the value using column name? edited: ==================================================
I edited my post because i figure it out how to get column by column name, need to write some lines of code but it works fine!!
if somebody else needs, here is the code:
var grid = cell.getGrid(); var colXIndex = grid.getColumn("mycolumn");
i don't like javascript because intellisense, but i have to say that your EO Components is very amazing! :) thanks!
|
|