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

Problems using changeGroupOperator

3 Answers 22 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Robin
Top achievements
Rank 1
Robin asked on 16 Aug 2012, 05:36 PM
I found this page: http://www.telerik.com/help/aspnet-ajax/filter-getting-familiar-with-client-side-api.html 

I tried to replicate the sample regarding changeGroupOperator but it's not working. I see the 1st alert but never see the second alert. I had to use $get as $find kept returning null.

    <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
<script type="text/javascript" language="javascript">
    var tmp1 = $get("<%= rfPortfolios.ClientID %>");
    alert(tmp1);
    tmp1.changeGroupOperator("0", "Or");
    alert('123');
</script>
</telerik:RadCodeBlock>


This is my scriptmanager:
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        LoadScriptsBeforeUI="false"
        EnableScriptGlobalization="true"
         EnableScriptLocalization="true"
         EnablePartialRendering="true"
         EnablePageMethods="true"
         ScriptMode="release" >
                 <Scripts >
            <ajax:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js">
            </ajax:ScriptReference>
            <ajax:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js">
            </ajax:ScriptReference>
            <ajax:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js">
            </ajax:ScriptReference>
        </Scripts>
</telerik:RadScriptManager>


Any ideas what's going wrong?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 21 Aug 2012, 10:36 AM
Hello Robin,

Note that the sample code in this page uses $find, not $get to access the RadFilter control. $get returns only its DOM representation but not the actual client object. So, try with:
<telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
    <script type="text/javascript" language="javascript">
       var tmp1 = $find("<%= rfPortfolios.ClientID %>");
       alert(tmp1);
       tmp1.changeGroupOperator("0", "Or");
       alert('123');
    </script>
</telerik:RadCodeBlock>

More information on the difference between $find and $get is available here:
http://sandblogaspnet.blogspot.com/2009/06/difference-between-get-and-find.html

All the best,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Robin
Top achievements
Rank 1
answered on 27 Aug 2012, 05:10 PM
Thank you for responding to my question, you did not address my problem. I stated that I was having issues with $find.
"I tried to replicate the sample regarding changeGroupOperator but it's not working. I see the 1st alert but never see the second alert. I had to use $get as $find kept returning null."

Since tmp1 is null, changeGroupOperator fails and I never see the second alert. If I am supposed to use $find, then is there any way you can figure out why $find is not working?

Thank you.

~Robin
0
Robin
Top achievements
Rank 1
answered on 27 Aug 2012, 05:33 PM
Never mind, I figured out what was wrong. I needed to wrap my javascript inside a pageLoad.
Tags
Filter
Asked by
Robin
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Robin
Top achievements
Rank 1
Share this question
or