Running custom jquery plugins and javascript

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
12/2/2009 7:52:13 PM
Gravatar
Total Posts 2

Running custom jquery plugins and javascript

Hi

I'm trying to build a proof-of-concept application using mojoPortal as the container for some custom functionality.

The poc consists of basically a single page, which I've migrated from an ASPX to a WebControl; so far so good, I get the content into a page and all works ok.

The control (rather the page that it was created from) has quite a bit of client-side functionality; a couple of dropdown lists with Javascript events to set corresponding label values (which in turn use jquery selects), some links and html buttons that have handlers that use Jquery to post to to static WebMethods and some visual 'sugar' implemented using jGrowl and jquery.timers plugins.

I've managed to get the scripts into layout.master via the ScriptLoader (and the references appear correct, because I'm getting posts through to the page methods ok, as far as I can tell) but the rest of the interactivity is lost; jGrowl and jquery.timers don't function and my 'hand rolled' methods to set the dropdown help labels don't work at all.

I guess my question is, is there any reason why client-side features like this won't work? This is a pure proof of concept, so I'm not worried about page weight in terms of loading a heap of javascript on each request - at least not for the moment - but if anyone can offer any advice or ideas, I'd really appreciate it. I'm relatively new to mojo, so I guess this type of question must have been asked before, but I'm blown away by the amount of functionality in here already and the quality of the application and I'd really love to use it for both the POC and for the project that would follow (preferably without getting my hands dirty embedding flash in here ;-)

Thanks  for any advice you guys can give.

12/3/2009 4:12:41 PM
Gravatar
Total Posts 18439

Re: Running custom jquery plugins and javascript

Hi Paul,

Note that jquery and jquery UI are loaded already by our ScriptLoader control which does not support adding your own files, so I suspect you mean you are using ScriptManager to include your custom files.

Make sure anything that depends on jquery is being included after the jquery files (view the source of the rendered page to check). If the ScriptManager is loading them before the main jquery files you may need to add your scriptws using a UserControl which you can put in the layout.master after the ScriptLoader and inside the UserControl you can add scripts with code like this:

Page.ClientScript.RegisterClientScriptBlock(typeof(Page),

"oomph", "\n<script src=\""

+ Page.ResolveUrl("~/ClientScript/oomph/oomph.min.js") + "\" type=\"text/javascript\" ></script>");

Note, the best way to easily find out what is going wrong is to use Firefox and the Firebug plugin which can show you where script errors are happening.

Hope it helps,

Joe

12/6/2009 2:34:14 PM
Gravatar
Total Posts 2

Re: Running custom jquery plugins and javascript

Hey Joe,

Thanks for taking the time out to respond and for the information. Had another look through the video's, which was a real help.

I've been looking through the html that's generated for my ascx and noticed that - in the case of the dropdowns that I'm using - the styles are getting inlined, and I'm losing the cssclass attribute from the markup, which drops the marker that my jquery selects are looking for.

I simply added in an extra class='<my_jquery_style>' and everything springs back into life. Simple workaround; probably due to not having the css set up correctly yet. I guess there's still a bit of work to get the rest of the scripts to work, but it's at least a start.

Thanks again; awesome product.

Best

Paul

You must sign in to post in the forums. This thread is closed to new posts.