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

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

5 Answers 98 Views
Filter
This is a migrated thread and some comments may be shown as answers.
J
Top achievements
Rank 1
J asked on 08 Mar 2016, 09:07 PM

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>

5 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 11 Mar 2016, 01:34 PM
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.
0
J
Top achievements
Rank 1
answered on 11 Mar 2016, 05:47 PM
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?
0
Maria Ilieva
Telerik team
answered on 16 Mar 2016, 11:37 AM
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.
0
J
Top achievements
Rank 1
answered on 18 Mar 2016, 06:53 PM
Thanks Maria.
0
Maria Ilieva
Telerik team
answered on 23 Mar 2016, 02:53 PM
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.
Tags
Filter
Asked by
J
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
J
Top achievements
Rank 1
Share this question
or