Hello, I have following RadGrid containing nested GridTableViews. Every row has CheckBox and I would like to select and deselect them in ClientSide. I have following Javascript code.
function RowSelected(sender, eventArgs) { var dataItem = sender.get_masterTableView().get_dataItems()[eventArgs._itemIndexHierarchical]; var str = eventArgs._itemIndexHierarchical; if (typeof (dataItem) == "undefined") { dataItem = sender.get_detailTables()[0].get_selectedItems()[str]; } if (typeof (dataItem) == "undefined") { dataItem = sender.get_detailTables()[1].get_selectedItems()[str]; } if (isDeselecting) { if (id == dataItem._itemIndexHierarchical) { dataItem.set_selected(false); isDeselecting = false; } else id = dataItem._itemIndexHierarchical; } else if (isDeselecting == false) { id = dataItem._itemIndexHierarchical; isDeselecting = true; } } My aspx Page is declared as followed.
<telerik:RadGrid ID="RadGridSubOrganizations" runat="server" BorderStyle="Solid" AllowFilteringByColumn="false" AutoGenerateColumns="false" Visible="true" Width="100%" OnItemCommand="RadGridSubOrganizations_ItemCommand" Height="150px" OnDetailTableDataBind="RadGridSubOrganizations_DetailTableDataBind" OnItemDataBound="RadGridSubOrganizations_ItemDataBound" SortingSettings-EnableSkinSortStyles="true" MasterTableView-ExpandCollapseColumn-Display="true" AllowSorting="false" ShowStatusBar="true" GridLines="None" HeaderStyle-BackColor="#BDBDBD"> <MasterTableView CellSpacing="-1" AllowNaturalSort="false" TableLayout="Fixed" Name="Organization" DataKeyNames="ParentOrganizationId,ChildOrganizationId,SubChildOrganizationId" ItemStyle-BackColor="#B0C4DE" GridLines="None"> <HeaderStyle CssClass="HeaderColor" /> <DetailTables> <telerik:GridTableView DataKeyNames="ParentOrganizationId,ChildOrganizationId" Width="100%" GridLines="None" HeaderStyle-BackColor="#BDBDBD" HeaderStyle-ForeColor="Black" ItemStyle-BackColor="#ADD8E6"> <DetailTables> <telerik:GridTableView DataKeyNames="ParentOrganizationId,ChildOrganizationId,SubChildOrganizationId" Width="100%" ItemStyle-BackColor="#DEF3FA" GridLines="None" HeaderStyle-BackColor="#BDBDBD" HeaderStyle-ForeColor="Black"> When event comes to javascript function index of row is in variable eventArgs._itemIndexHierarchical.
But if Row in GridTableView is selected eventArgs._itemIndexHierarchical contains mystic index like: 1:0_0:0_0_0 and exception is thrown when trying to get dataItem from GridTableView. How should I reference to index? Couldn't find any samples or documentation considering this.
How to do this?
Br
Michael