Problems using changeGroupOperator

4 posts, 0 answers
  1. Robin
    Robin avatar
    23 posts
    Member since:
    Oct 2011

    Posted 16 Aug 2012 Link to this post

    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.
  2. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 21 Aug 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Robin
    Robin avatar
    23 posts
    Member since:
    Oct 2011

    Posted 27 Aug 2012 Link to this post

    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
  5. Robin
    Robin avatar
    23 posts
    Member since:
    Oct 2011

    Posted 27 Aug 2012 Link to this post

    Never mind, I figured out what was wrong. I needed to wrap my javascript inside a pageLoad.
Back to Top