1.) For the grid below, I don't allow the user to select Master table items, only select (via clientsidecheckbox) the detail table items. When the Master is expanded I select the detail items, then I do a postback, the items are persisted and still checked. BUT, when I unexpand the items, do the postback, and then expand the items, the items are no longer checked. WHY? How can I make sure that the DETAIL Table items are selected after the master has been expanded, closed, postback occurs, then expanded again.
2.) I believe Telerik should correct this issue. You should be able to click a row without it affecting the rest of the other rows.
If the row clicked is already selected, the it should deselect that row (only), and vice versa, if it's deselected already then it should select that row only.
I CAN'T STAND IT when I have selected 20 rows and then when I accidently click outside a checkbox, I loose all my selections. I have the following radgrid, please show me if there is a way, how to achieve this. I already tried the ToggleSelection.js solution, but I get alot of errors because it was not designed for Heirarchy Grid.
var
rccoc_selected = {};
function rgChildObjects_GridCreated(sender, args) {
var scrollArea = sender.GridDataDiv;
var dataHeight = sender.get_masterTableView().get_element().clientHeight;
if (dataHeight < 200) {
scrollArea.style.height = dataHeight +
"px";
}
else {
//sender.get_masterTableView().get_element().style.width = "620px";
}
}
function rgChildObjects_RowSelected(sender, args) {
var customeID = args.getDataKeyValue("ReportingColumnID");
if (!rccoc_selected[customeID]) {
rccoc_selected[customeID] =
true;
}
}
function rgChildObjects_RowDeselected(sender, args) {
var customeID = args.getDataKeyValue("ReportingColumnID");
if (rccoc_selected[customeID]) {
rccoc_selected[customeID] =
null;
}
}
function rgChildObjects_RowCreated(sender, args) {
var customeID = args.getDataKeyValue("ReportingColumnID");
if (rccoc_selected[customeID]) {
alert(args.get_gridDataItem());
args.get_gridDataItem().set_selected(
true);
}
}
//***************************************//
function rgChildObjects_RowSelecting(sender, args) {
var e = args.get_domEvent();
//IE - srcElement, Others - target
var targetElement = e.srcElement || e.target;
//this condition is needed if multi row selection is enabled for the grid
if (typeof (targetElement) != "undefined") {
//is the clicked element an input checkbox? <input type="checkbox"...>
if (targetElement.tagName.toLowerCase() != "input" &&
(!targetElement.type || targetElement.type.toLowerCase() !=
"checkbox"))// && currentClickEvent)
{
//cancel the event
args.set_cancel(
true);
}
}
else
args.set_cancel(
true);
}
function rgChildObjects_RowDeselecting(sender, args) {
var e = args.get_domEvent();
//IE - srcElement, Others - target
var targetElement = e.srcElement || e.target;
//this condition is needed if multi row selection is enabled for the grid
if (typeof (targetElement) != "undefined") {
//is the clicked element an input checkbox? <input type="checkbox"...>
if (targetElement.tagName.toLowerCase() != "input" &&
(!targetElement.type || targetElement.type.toLowerCase() !=
"checkbox"))// && currentClickEvent)
{
//cancel the event
args.set_cancel(
true);
}
}
else
args.set_cancel(
true);
}
<telerik:RadGrid ID="rgChildObjects" AllowMultiRowSelection="true" AutoGenerateColumns="false" Width="295px" runat="server">
<MasterTableView HierarchyDefaultExpanded="false" HierarchyLoadMode="client" Name="ChildObjects" DataKeyNames="ReportingChildObjectID">
<DetailTables>
<telerik:GridTableView Name="Columns" Width="100%" ShowHeader="true" DataKeyNames="ReportingColumnID">
<Columns>
<telerik:GridClientSelectColumn />
<telerik:GridBoundColumn HeaderStyle-Font-Bold="true" itemstyle-wrap="false" UniqueName="DefaultDescription" DataField="DefaultDescription" HeaderText="Child Report Column(s)" />
</Columns>
</telerik:GridTableView>
</DetailTables>
<Columns>
<telerik:GridBoundColumn ItemStyle-font-bold="true" HeaderStyle-Font-Bold="true" HeaderStyle-wrap="false" UniqueName="ChildObjectName" DataField="ChildObjectName" HeaderText="Child Reports" />
</Columns>
</MasterTableView>
<ClientSettings AllowExpandCollapse="true">
<Selecting EnableDragToSelectRows="false" AllowRowSelect="true" />
</ClientSettings>
</telerik:RadGrid>