|
Rank: Advanced Member Groups: Member
Joined: 9/2/2010 Posts: 120
|
Hi, See the Grid object example below (ignore the content because it is in Portuguese): Only the green rows may be edited. How do I do to not allow the user to select the blue line when they click the mouse over it? Thanks, Camarate
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You would set those rows to use a different "StyleSet" so that for those rows, the selected style and normal style are the same. That way the rows can still be "selected", but they will not be highlighted so that visually they do not look selected at all. To set rows to use different StyleSet, you would use conditional formatting based on rows. See here for a working example: http://demo.essentialobjects.com/Demos/Grid/Features/Conditional%20Formatting/Demo.aspxThanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 9/2/2010 Posts: 120
|
Hi,
Thanks for your reply. I'm thinking in another solution.
If in a Javascript function I could change the selected item, I could put an invisible column with a flag. When the user clicks on a row, a function would be run by OnItemSelected, and check the flag and if necessary, increments the index until an item that can be selected.
This is possible?
Regards, Camarate
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
|
|
Rank: Advanced Member Groups: Member
Joined: 9/2/2010 Posts: 120
|
Hi, The idea was OK. Thanks so much for your suggestion. I'm put the Javascript function below to others that need the same functionality.
Code: JavaScript
function OnItemSelected(grid)
{
var item = grid.getSelectedItem();
var cell = item.getCell(1);
while (cell.getValue() == 0)
{
grid.selectItem(item.getIndex() + 1);
item = grid.getSelectedItem();
cell = item.getCell(1);
}
}
Put the function name in the grid parameter CientSideOnItemSelected, and in my example, I created a column with index 1 that is a flag. When equal 0 the row is non-selectable. When equal 1 the row is selectable. In my case I do not be worry because will always have a selectable row after a non-selectable. Regards, Camarate
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Great. Thanks for sharing!
|
|