RadGrid ClientDataSource binding: after filtering so no records are present and removing the filter there is no pager
Problem
On Radgrid with client side binding - if you filter the grid and find no records, then remove the filter to have data back, the paging is not recreated.
Repro steps:
- go to the RadClientDataSource binding demo: Binding to Telerik ClientDataSource
- filter a column so there is no data in the grid
- remove the filter
Actual: the pager is gone
Expected: the pager is there
Visualization of the problem:
Solution
Add a handler to the OnCommand client-side event of the grid and show the pager:
<script>
function OnCommandHandler(sender, args) {
if (args.get_commandName() == "Filter") {
$telerik.$(sender.get_element()).find(".rgPager").show();
}
}
</script>
<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server">
<ClientSettings>
<ClientEvents OnCommand="OnCommandHandler" />
</ClientSettings>
</telerik:RadGrid>