Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > General Discussions > jQuery selectable and @(Html.Telerik().ScriptRegistrar())

Answered jQuery selectable and @(Html.Telerik().ScriptRegistrar())

Feed from this thread
  • Jaymie Intermediate avatar

    Posted on Nov 24, 2011 (permalink)

    Hi,

    I have another issue today :)
    I have found that using http://jqueryui.com/demos/selectable/ with @(Html.Telerik().ScriptRegistrar()) doesn't work.
    As soon as i remove the reference to the ScriptRegistrar, everything starts working.
    Is there something that I am doing wrong?

    @using (Html.BeginForm())
    {
        <ul id="selectable">   
            @foreach (IProfile oProfile in Model)
            {
                <li class="ui-widget-content">@oProfile.UserName</li>
            }
        </ul>   
    }       
     
    <script type="text/javascript">
        $(document).ready(function () {
            $("ul#selectable").selectable();
        });
    </script>

    The code above should work with my references to these libraries:

    <script src="@Url.Content("~/Scripts/jquery-1.6.2.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.16.custom.min.js")" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="@Url.Content("~/Content/themes/ui-lightness/jquery-ui-1.8.16.custom.css")" />

    But as soon as the reference to @(Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Combined(true).Compress(true))) is added, i get an "Error: Object doesn't support property or method 'selectable'" error....

    Please help me :)

    /Jaymie

  • Dimo Dimo admin's avatar

    Posted on Nov 24, 2011 (permalink)

    Hi Jaymie,

    The problem may be caused by the fact that you have two jQuery instances on the page. You can disable the automatic jQuery registration done by the ScriptRegistrar.

    http://www.telerik.com/help/aspnet-mvc/web-assets-working-with-javascript-web-assets.html#jQuery

    Regards,
    Dimo
    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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now

  • Jaymie Intermediate avatar

    Posted on Nov 25, 2011 (permalink)

    So how do i get around that?
    I have my script registrar in my layout, if I change it to the suggested format jquery starts working, but the treeview draggable stops working.
    If I have it enabled, then all the jquery stops working.

    I tried removing my reference to jQuery and keeping the normal Script Registrar, but that didn't solve anything.

    /Jaymie

  • Answer Dimo Dimo admin's avatar

    Posted on Nov 25, 2011 (permalink)

    Hi Jaymie,

    Generally, if you disable the ScriptRegistrar's jQuery registration, the only requirement is that your own jQuery registration comes before the ScriptRegistrar in the markup. The other of course is that the jQuery version is compatible with our MVC components.

    Do you have some Javascript errors that may point to the right direction? If you need further assistance, you can send us a runnable demo, which exhibits the problem, so that we can take a look.

    Regards,
    Dimo
    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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now

  • Nikos avatar

    Posted on Sep 4, 2012 (permalink)

    I also have the same issue, but
    .jQuery(false)
    fixed it, why is this necessary?

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > General Discussions > jQuery selectable and @(Html.Telerik().ScriptRegistrar())