voyent
Proper use of jQuery with IceFaces 4.1?  XML
Forum Index -> General Help
Author Message
chrisb-tm

Joined: 26/Jun/2012 15:03:04
Messages: 38
Offline


What is the correct way to be using jQuery with IceFaces 4.1? Should I be using "ice.ace.jq" instead of "$"? For example: ice.ace.jq(".test") instead of $(".test")?

What about existing code that is already using "$"? Do I need to change it to "ice.ace.jq"?

Thanks.


artzambrano

Joined: 21/Mar/2007 00:00:00
Messages: 177
Offline


Yes, that's correct. You would have to use 'ice.ace.jq' instead of '$' if you want to use our version of jQuery. You could also add your own version of jQuery to work alongside the icefaces' version. That's why we rename ours to 'ice.ace.jq', but I would recommend just using our version of jQuery.

You don't necessarily have to change every occurrence of '$' for 'ice.ace.jq' in your code. You could simply put your code inside an anonymous function that automatically gets executed, which takes an argument that you name '$', then you simply pass 'ice.ace.jq' as the argument. It would look something like this...

Code:
 (function($) {
 
 // your code using $
 
 })(ice.ace.jq);
 


If your code is more complex, and the approach above wouldn't work for you, you could simply define the global variable '$' to be 'ice.ace.jq', just make sure that this variable declaration occurs after the icefaces' javascript resources have been loaded.

Art Zambrano
ICEsoft Technologies Inc.
 
Forum Index -> General Help
Go to:   
Powered by JForum 2.1.7ice © JForum Team