Is it possible to make the filter preview expression update as filters are added?

6 posts, 0 answers
  1. J
    J avatar
    30 posts
    Member since:
    Oct 2012

    Posted 08 Mar Link to this post

    I'm guessing the preview updates on posts because it updates when I add/remove/update filter expressions and groups, and it updates when I load the grid. I would prefer it to update as I'm making changes, because to me, a "preview" doesn't really count if I have to load first. For example, If I only add one filter expression, the preview doesn't show anything...until I load the grid. If I add three expressions then a group expression, the first three expressions will show in the preview correctly, but then the group expression doesn't, because there's no server post between choosing the last expression value and loading the grid. So, the question - is it possible to update the preview expression in "real time"? Code for reference:

     

    01.<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
    02.    <AjaxSettings>
    03.        <telerik:AjaxSetting AjaxControlID="rgFilings">
    04.            <UpdatedControls>
    05.                <telerik:AjaxUpdatedControl ControlID="rgFilings" LoadingPanelID="RadAjaxLoadingPanel1"/>
    06.                <telerik:AjaxUpdatedControl ControlID="rfFilter"/>
    07.            </UpdatedControls>
    08.        </telerik:AjaxSetting>
    09.    </AjaxSettings>
    10.    <AjaxSettings>
    11.        <telerik:AjaxSetting AjaxControlID="rfFilter">
    12.            <UpdatedControls>
    13.                <telerik:AjaxUpdatedControl ControlID="rfFilter"/>
    14.            </UpdatedControls>
    15.        </telerik:AjaxSetting>
    16.    </AjaxSettings>
    17.</telerik:RadAjaxManager>

    1.<telerik:RadFilter runat="server" ID="rfFilter" RenderMode="Lightweight" FilterContainerID="rgFilings" ShowApplyButton="False" ViewStateMode="Enabled" OnApplyExpressions="rfFilter_ApplyExpressions" OnExpressionItemCreated="rfFilter_ExpressionItemCreated" ExpressionPreviewPosition="Bottom">
    2.    <ContextMenu RenderMode="Lightweight"></ContextMenu>
    3.    <FieldEditors>
    4.        <telerik:RadFilterDropDownEditor FieldName="DelApprStatus" DisplayName="Status" DataTextField="Value" DataValueField="Value" />
    5.        <telerik:RadFilterDropDownEditor FieldName="District" DisplayName="Reserve Bank" DataTextField="Value" DataValueField="Value" />
    6.    </FieldEditors>
    7.</telerik:RadFilter>

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 11 Mar Link to this post

    Hello,

    In order to achieve the required functionality you can try executing manual ajaxReques when a new filter is created and rebind the RadGrid on the server like this:
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
                    <AjaxSettings>
                         <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="rgFilings" />
                                <telerik:AjaxUpdatedControl ControlID="rfFilter" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                        <telerik:AjaxSetting AjaxControlID="rfFilter">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="rgFilings" LoadingPanelID="RadAjaxLoadingPanel1" />
                                <telerik:AjaxUpdatedControl ControlID="rfFilter" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                    </AjaxSettings>
                </telerik:RadAjaxManager>
     
    <telerik:RadFilter ClientSettings-ClientEvents-OnFilterCreated="Refresh" runat="server"></telerik:RadFilter>
            <telerik:RadCodeBlock runat="server">
                <script>
                    function Refresh(){
                    var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
                        ajaxManager.ajaxRequest(arguments);
                    }
                </script>
            </telerik:RadCodeBlock>

    private void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
           {
              rgFilings.Rebind();
           }

    I hope this helps.

    Regards,
    Maria Ilieva
    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
  4. J
    J avatar
    30 posts
    Member since:
    Oct 2012

    Posted 11 Mar in reply to Maria Ilieva Link to this post

    Thank you for the reply, Maria. I added all of the code you suggested, but my $find function always returned null. I am completely sure that I have the correct control name (RadAjaxManager1). Do you have any ideas as to why?
  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 16 Mar Link to this post

    Hello,

    Try to access the RadAjaxManager like this:
    find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest();
     and see how it goes.

    Regards,
    Maria Ilieva
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  6. J
    J avatar
    30 posts
    Member since:
    Oct 2012

    Posted 18 Mar in reply to Maria Ilieva Link to this post

    Thanks Maria.
  7. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 23 Mar Link to this post

    Hi,

    I hope the provided solution helped. Do not hesitate to contact us back in case further assistance is needed.

    Regards,
    Maria Ilieva
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017