This is a migrated thread and some comments may be shown as answers.

Clear checkboxes in filter CheckList

5 Answers 278 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 02 Feb 2015, 02:39 PM
Hi

I have created a method that serverside clears all filters,

foreach (GridColumn column in radGrid.MasterTableView.Columns)
            {
                 
                column.CurrentFilterFunction = GridKnownFunction.NoFilter;
                column.CurrentFilterValue = string.Empty;
            }
            radGrid.MasterTableView.FilterExpression = string.Empty;
            radGrid.MasterTableView.Rebind();

Works as expected,  but the checkboxes in the Checklists are not unchecked.
Can I somehow uncheck the Checklists serverside?
(The grid filertype is "Combined") 

 

Regards
John

5 Answers, 1 is accepted

Sort by
0
Accepted
Konstantin Dikov
Telerik team
answered on 05 Feb 2015, 12:01 PM
Hi John,

There is currently a bug with the clearing of the selected items when CheckList filtering is used. You can take a look at the logged item in our Ideas & Feedback Portal:
Nevertheless, you can refer to the attached sample page, where you will see how you can manually clear the checked values with the CheckList Filtering.

Hope this helps.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Peter
Top achievements
Rank 1
answered on 27 Apr 2015, 05:04 AM
Is this fixed yet?
0
Peter
Top achievements
Rank 1
answered on 27 Apr 2015, 05:11 AM
The sample JavaScript didn't work - I tried with both the hard-coded name of the Grid AND with the Client ID version of the Grid and the checkboxes remained clicked. 
0
Peter
Top achievements
Rank 1
answered on 27 Apr 2015, 05:14 AM

Interestingly, the JavaScript never fires in the Code Block! 

 

<CommandItemTemplate>
                <div style="padding: 5px 5px;">
                    <div style="float: right;">
                        <asp:LinkButton ID="lbClearFilters" runat="server" CommandName="ClearFilters" OnClick="lbClearFilters_Click" CausesValidation="false" OnClientClick="clearCheckboxes"><img style="border:0px;vertical-align:middle;" alt="" src="/images/filter.gif" /> Clear filters</asp:LinkButton>
                    </div>
                </div>
            </CommandItemTemplate>

 

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function clearCheckboxes(sender, args) {
                var clientState = JSON.parse($find("<%# rgRepricingApproval.ClientID %>").get_clientState());
                clientState.checkListFilterValues = [];
                clientState.checkListFilterKeys = [];
                $find("<%# rgRepricingApproval.ClientID %>").set_clientState(JSON.stringify(clientState));
            }
        </script>
    </telerik:RadCodeBlock>

0
Konstantin Dikov
Telerik team
answered on 29 Apr 2015, 10:45 AM
Hi Peter,

Since you are using LinkButton control (and not RadButton as in the attached sample project), the handler of the OnClientClick event should be as shown below:
<asp:LinkButton runat="server" OnClientClick="clearCheckboxes()" ......>....</asp:LinkButton>

You can refer to the following MSDN article for detailed information:

Regards,
Konstantin Dikov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Peter
Top achievements
Rank 1
Share this question
or