delayfiler not work for FilterTemplate in radgrid !

2 posts, 1 answers
  1. حمید
    حمید avatar
    13 posts
    Member since:
    Dec 2015

    Posted 04 Apr Link to this post

    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>

  2. Answer
    Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 05 Apr Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top