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

delayfiler not work for FilterTemplate in radgrid !

1 Answer 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
حمید
Top achievements
Rank 1
حمید asked on 04 Apr 2016, 12:34 PM

Hi Telerik

I wana to set DelayFilter for  FilterTemplate  in RadGrid but when i set that , it's not work !

why this not work and how to set it ?

please help me .

Thanks

<telerik:GridTemplateColumn DataField="ProvinceName" HeaderText="ProvinceName" SortExpression="ProvinceName" UniqueName="ProvinceName" FilterDelay="1000">
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                <ClientItemTemplate>
                                    #=ProvinceName#
                                </ClientItemTemplate>
                                <FilterTemplate>
                                    <telerik:RadTextBox ID="txtProvinceName" runat="server">
                                        <ClientEvents OnValueChanged="ProvinceNameChenged"></ClientEvents>
                                    </telerik:RadTextBox>
                                    <telerik:RadScriptBlock ID="rsbProvinceName" runat="server">
                                        <script type="text/javascript">
                                            function ProvinceNameChenged(sender, args) {
                                                var gv = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                                if (args.get_newValue() == "") {
                                                    gv.filter("ProvinceName", null, "NoFilter");
                                                    return;
                                                }
                                                gv.filter("ProvinceName", args.get_newValue(), "StartsWith");
                                            }
                                        </script>
                                    </telerik:RadScriptBlock>
                                </FilterTemplate>
                            </telerik:GridTemplateColumn>

1 Answer, 1 is accepted

Sort by
0
Accepted
Viktor Tachev
Telerik team
answered on 05 Apr 2016, 12:31 PM
Hi,

In order to delay the filter execution when using template you would need to add that delay to the custom logic. You can wrap the code in the ProvinceNameChenged handler in setTimeout() and specify the delay.

function ProvinceNameChenged(sender, args) {
    setTimeout(function () {
        var gv = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
        if (args.get_newValue() == "") {
            gv.filter("ProvinceName", null, "NoFilter");
            return;
        }
        gv.filter("ProvinceName", args.get_newValue(), "StartsWith");
    }, 1000);
}


Regards,
Viktor Tachev
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
حمید
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or