More in this section

Forums / Developing with Sitefinity / Guide to integrating jQuery into Sitefinity

Guide to integrating jQuery into Sitefinity

10 posts, 0 answered
  1. Samir Vaidya
    Samir Vaidya avatar
    261 posts
    Registered:
    05 Feb 2005
    08 Aug 2012
    Link to this post
    I know with Drupal, there is a guide to integrating jQuery that shows you how to install Drupal plug-ins and even update to the latest version of jQuery for use with the CMS.

    Is there a similar guide for integrating jQuery, jQuery UI, jQuery Mobile and various jQuery plugins into Sitefinity?  If so, where can I find this guide or documentation?

    Does the guide offer any best practices or patterns for integrating jQuery into Sitefinity CMS?
  2. Richard
    Richard avatar
    64 posts
    Registered:
    09 Oct 2012
    27 Sep 2012
    Link to this post
    I need this as well. I'm wanting to include some jQuery plugins but they don't seem to work no matter where or how I try to include them. I've tried putting them in as ResourceLinks, in the script manager, loaded them through the javascript widget -- pasting in the code directly and then placing them in all different locations (in the head tag, where the widget is dropped, before the closing body tag) on the page, also trying the 'link to a javascript file' where you browse to pick the file -- even though i'm picking it directly it isn't even finding the file Plugins just don't seem to work. What is the process for integrating plugins? 

    Could my problems have something do with creating the site on a development server?
  3. Richard
    Richard avatar
    64 posts
    Registered:
    09 Oct 2012
    28 Sep 2012
    Link to this post
    Seems to work now with the JavaScriptEmbedControl Method
  4. Jochem Bökkers
    Jochem Bökkers avatar
    787 posts
    Registered:
    13 Aug 2007
    29 Sep 2012
    Link to this post
    Hey Richard,

    Just as a heads up regarding JavaScriptEmbedControl, if you have a .Master page which a code behind (and thus also a designer.cs) the use of JavaScriptEmbedControl causes VisualStudio to throw errors when trying to update the designer file.

    Secondly. keep an eye out for proper capitalization, otherwise VisualStudio will interpret it as not a Sitefinity control but a regular .NET control with all subsequent errors...

    Jochem
  5. MB
    MB avatar
    302 posts
    Registered:
    09 Jan 2005
    29 Sep 2012
    Link to this post
    @Jochem

    Just for fun, I put a contentplaceholder on my masterpage, in the header section, and then added my JavaScripEmbedControl references to it from the code behind... as I figured if I'm going to hard code it somewhere, programatic is as good as declaritive.

    Seems to work ok, and puts the scripts where I wanted.

    Now, if I could just get that pesky ResourceLinks/File thing to put things where I asked it to, I'd be a happy(ier) camper.
  6. Jochem Bökkers
    Jochem Bökkers avatar
    787 posts
    Registered:
    13 Aug 2007
    29 Sep 2012
    Link to this post
    @MB,

    At the moment I just 'extracted' the JavaScriptEmbedControl to a usercontrol so my designer plays nice at least. But haven't found a good work-around for the ResourceLinks.

    Not using them, but load jQuery another way causes double loading, using them leaves you in the passenger seat with no render control. I even tried playing with the extracted Telerik.Resources scripts to see if that wouldn't trigger a double load but unsuccessful (as of yet). 

    Its a trade off between easy development vs optimum client experience I'm afraid.

    Jochem
  7. Richard
    Richard avatar
    64 posts
    Registered:
    09 Oct 2012
    09 Oct 2012 in reply to Jochem Bökkers
    Link to this post
    Thanks for the tip. I don't have a code behind file as of yet, but I'll keep that in mind for the future. Have you tried using the Kangaroo Add References Widget from the Marketplace?
  8. Jochem Bökkers
    Jochem Bökkers avatar
    787 posts
    Registered:
    13 Aug 2007
    10 Oct 2012 in reply to Richard
    Link to this post
    Hey Richard,

    Yes ofcourse :)
    I constantly look for ways to improve and optimize and Peter certainly did a great job with his controls. I'm not going to use them however, I feel by doing things manually I still have better control but its a god-gift for power users who don't like messing with VisualStudio though.

    Jochem.
  9. Richard
    Richard avatar
    64 posts
    Registered:
    09 Oct 2012
    26 Oct 2012 in reply to Jochem Bökkers
    Link to this post
    Hey Jochem, I'm such a newbie that I'm not sure how to get the Kangaroo widget up and running. Could you give me a brief explanation of how to set it up?

    Thanks!

    I'm still looking for a reliable fool proof way to use Javascript Plugins. I didn't think it would be such a tricky process. I'm trying to use a Google Maps plugin and I can't for the life of me get it to work though in a standard HTML page it loads fine.

  10. Jochem Bökkers
    Jochem Bökkers avatar
    787 posts
    Registered:
    13 Aug 2007
    29 Oct 2012 in reply to Richard
    Link to this post
    Hey Richard,

    I've started writing up a blogpost on jQuery/Kangaroo/JS Widget and the chaos it seems to cause, although due to the schedule it probably be not until end of the week till its up, in the meantime (like I said in the other thread) feel free to spam me by email to get you up and running :)

    Jochem
10 posts, 0 answered