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

How to clear column filter on client side?

1 Answer 131 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lenny_shp
Top achievements
Rank 2
Lenny_shp asked on 16 Sep 2014, 09:00 PM
2014.2.909.45

Can you tell me what is the correct syntax for these two usages:

Clear the column's filter: - not working as expected when passing blank in the 2nd parameter.
tableview.filter("profile", '', "NoFilter");

Setting the filter to IsNull - not working as expected when passing blank in the 2nd parameter.
tableView.filter("profile", '' , "IsNull");


    <telerik:GridTemplateColumn HeaderText="Profile" HeaderStyle-Width="200px" UniqueName="sf_profile" DataField="profile" DataType="System.String">
                        <ItemTemplate>
                            <%# Eval("profile") %>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadDropDownList runat="server" ID="ProfileIdropDown" DataValueField="lov_profile" DataTextField="lov_profile" Width="200px"
                                 DataSourceID="srcProfile">
                            </telerik:RadDropDownList>
                        </EditItemTemplate>
                        <FilterTemplate>
                            <telerik:RadComboBox runat="server" ID="cboProfileFilter" DataSourceID="srcProfile" AppendDataBoundItems="true" Width="200px"
                                DataValueField="lov_profile" DataTextField="lov_profile"
                                SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("profile").CurrentFilterValue %>'
                                OnClientSelectedIndexChanged="ProfileIndexChanged">
                                <Items>
                                    <telerik:RadComboBoxItem Text="All" />
                                    <telerik:RadComboBoxItem Text="[Blank]" Value="" />
                                </Items>                        
                            </telerik:RadComboBox>
                        
                            <telerik:RadScriptBlock ID="RadScriptBlockProfile" runat="server">
                                <script type="text/javascript">
                                    function ProfileIndexChanged(sender, args) {
                                        var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        if (args.get_item().get_value() == 'All') {
                                            tableview.filter("profile", '', "NoFilter");
                                        } else if (args.get_item().get_value() == '') {
                                            tableView.filter("profile", '' , "IsNull");
                                        } else {
                                            tableView.filter("profile", args.get_item().get_value(), "EqualTo");                                            
                                        }
                                    }
                                </script>
                            </telerik:RadScriptBlock>                           
                        </FilterTemplate>
                    </telerik:GridTemplateColumn>

1 Answer, 1 is accepted

Sort by
0
Lenny_shp
Top achievements
Rank 2
answered on 17 Sep 2014, 02:03 PM
I got this to work:

if (filterVal == "") {
      tableView.filter("team", filterVal, "NoFilter");
} else if (filterVal == '[Blank]') {
    tableView.filter("team", filterVal, "IsNull");
Tags
Grid
Asked by
Lenny_shp
Top achievements
Rank 2
Answers by
Lenny_shp
Top achievements
Rank 2
Share this question
or