I am using the RadGrid to present information which must be multiselected before a button is pressed for processing. I am able to replicate the functionality I am looking for from the RadGrid by holding the Ctrl button down and selecting/deselecting only the cells I want. But I need to be able to configure the grid to handle this without my holding the Ctrl button down on the client-side.
I tried overriding the OnCellSelecting event under ClientEvents and using the following code:
The problem is when args.set_cancel(true) I can modify the selection array, but it doesn't complete the selection process and display the selections on the grid. And when I have args.set_cancel(false) it overrides my efforts and replaces the selection with a single cell selection. How can I make this work?
I tried overriding the OnCellSelecting event under ClientEvents and using the following code:
<script type=
"text/javascript"
>
function
cellSelecting(sender, args) {
var
selects = sender._selectedCellsIndexes;
var
selectedColumn = args.get_column();
var
dataItem = args.get_gridDataItem();
var
cellName = dataItem.get_itemIndexHierarchical() +
"&"
+ selectedColumn.get_uniqueName();
var
output = String.format(cellName);
var
index = -1;
for
(
var
i = selects.length - 1; i >= 0; i--) {
if
(selects[i] === cellName) {
index = i;
}
}
console.log(dataItem);
if
(index == -1)
{
selects.push(cellName);
}
else
{
selects.splice(index, 1);
dataItem._selected =
false
;
}
selectedColumn.set_selected(dataItem.get_itemIndexHierarchical());
//sender.set_selected(selects);
selectedColumn.set_selected(selects);
console.log(sender);
console.log(selects);
// args.set_cancel(true);
//alert(output)
}
</script>
The problem is when args.set_cancel(true) I can modify the selection array, but it doesn't complete the selection process and display the selections on the grid. And when I have args.set_cancel(false) it overrides my efforts and replaces the selection with a single cell selection. How can I make this work?