Hello,
I'm working with a RadGrid that has AllowMultiRowSelection set to "true":
<telerik:RadGrid ID="sampleRgId" runat="server" AllowPaging="True" AllowCustomPaging="True" SkinID="Default"
PageSize="20" AllowAutomaticDeletes="false" AllowAutomaticUpdates="false" AllowMultiRowSelection="true" OnDetailTableDataBind="sampleRgDetailTableDataBind" RetainExpandStateOnRebind="True" HierarchyLoadMode="ServerOnDemand" EnableViewState="true">
<ClientSettings>
<Selecting AllowRowSelect="true" />
<ClientEvents OnRowSelected="sampleRgRowSelected"
OnRowDeselected="sampleRgRowDeselected"/>
</ClientSettings>
<MasterTableView Name="sample"
runat="server" Width="100%"
HierarchyLoadMode="ServerOnDemand" ShowHeader="True"
ShowFooter="True" AllowPaging="True"
AllowCustomPaging="True" PageSize="20"
AllowFilteringByColumn="True" DataMember="sampleRgTable"
EnableHierarchyExpandAll="True" EnableGroupsExpandAll="True"
RetainExpandStateOnRebind="True" DataKeyNames="dataKeyOne, dataKeyTwo">
<Columns>
<telerik:GridClientSelectColumn UniqueName="uniqueNameOne" Display="True" HeaderStyle-Width="35px"
HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" />
<telerik:GridBoundColumn HeaderText="Header Text" DataField="dataFieldOne" UniqueName="UniqueNameTwo"
SortExpression="UniqueNameTwo" HeaderStyle-Width="50%" FilterControlWidth="70%" />
...
The "sampleRgRowSelected" function looks like this:
asyncfunctionsampleRgRowSelected(sender, args){
let masterTable = $find("<%= sampleRgId.ClientID %>").get_masterTableView();
let itemIndex = args.get_itemIndexHierarchical();
masterTable.fireCommand("SelectRow", itemIndex);
}
The "SelectRow" function in the code-behind looks like this:
PrivateSub SelectParentGroup(e As GridCommandEventArgs)
Dim itemIndex as Integer = e.CommandArgument
Dim item As GridDataItem = e.Item.OwnerTableView.Items(itemIndex)
processData(item)
item.Selected = trueEndSub
I'm having two problems with the above when I click the "multi row selection" / "select all" checkbox in the RadGrid:
1- Selected rows aren't staying selected. When I click "Select All," every row is selected at first. After a minute, though, only the last row shows as selected. I'm guessing that is because of the ItemCommand taking some time to fire for each row. Then the final state is only having the last row selected.
2- When I have > 6 rows, not every row is selected. When I click "Select All," the sampleRgRowSelected() JavaScript function runs for every row in the RadGrid, starting with the last row. However, the ItemCommand is not fired for every row in the RadGrid. Only the first 6 rows as well as the last one have had "SelectRow" called on them.
Is there a way to know when "select all" has been selected in a RadGrid? If I knew that, I could just manually call processData and select each item. That would work better because I could also select paginated items when "select all" has been clicked.
Thanks for your time.