I have a grid with 30 rows and 18 columns. I only want the user to be able to select/ activate 4 of the rows (based on value) and only some of the cells based on value at runtime. I would prefer to do this in vb (code behind) but could use JavaScript if requried. In pseudo code:
If not row.activableflag then set all cells in row not activeable Else if cellvalue > 0 then set cell activable else set cell notactivable end if End If
Hello Graham,
Have you been able to resolve the issue? If you need any further assistance, please let me know.
Sincerely,
Tsanna
Did you have a chance to look at the sample that I've attached you in my previous response?
Essentially an option is to handle the CellSelectionChanging client side event of the Selection behavior and enable selection only of certain rows and cells like the following:
function WebDataGrid1_Selection_CellSelectionChanging(sender, eventArgs) {
var cell = eventArgs.getNewSelectedCells().getCell(0);
if (cell.get_row().get_index() > 3 || cell.get_value() == "Name0") {
eventArgs.set_cancel(true);
}
The above code snippet shows how to enable the selection only for the first four rows excluding the cell with value "Name0".
Does this help you for that what you're trying to achieve? Looking forward to hearing from you.
I am still looking for help with this issue.
Have you been able to resolve the issue? If you have any further questions, please feel free to contact me.
Hello Wade,
Thank you for your patience.
In order to cancel row/cell selection, the only cancelable events are Cell/RowSelectionChanging client side events. I’ve created for you a sample that demonstrates WDG with Selection behavior enabled and only the first four rows cells are selectable. For the rest the CellSelectionChanging event fires and is canceled. You can achieve this if you get reference to the new cell that will be selected and check for the row index that this cell is related to. For instance:
if (cell.get_row().get_index() > 3) {
Attached is also a sample with similar scenario. If you have any further questions, please let me know.