[fusion-users] Other Javascript Libraries with Fusion.

Paul Spencer pspencer at dmsolutions.ca
Thu Jul 3 12:29:05 EDT 2008


Hi Tómas,

Jx currently uses the Prototype library for this kind of stuff, I'm  
not sure but I don't think jQuery and Prototype co-exist very well.

Prototype also defines the $() function as a shortcut for  
document.getElementById, you should be able to do something like this:

$('myElement').addClassName('activeRow');

or

$('myElement').className = 'activeRow';

When working with dialogs, it is important to know when the content is  
loaded and to only attempt to modify things inside the dialog after  
the content is loaded, otherwise the elements won't exist (because  
they are loaded asynchronously).  There is an onContentLoaded option  
that you can provide a function to for this purpose.  Alternately you  
can provide a reference to an existing HTML element in the page and  
avoid the asynchronous problems, I think you specify contentID:  
'myElement' instead of contentURL

Cheers

Paul

On 3-Jul-08, at 12:05 PM, Tómas Guðmundsson wrote:

> Hi all.
>
> I have been trying to do what seems now an impossible feat. That is  
> changing the class of an element inside a page that is loaded with  
> Ajax requests into a Jx.Dialog. Sounds complicated ? Well the thing  
> is I wanted to try and use another very, very great Javascript  
> library called jQuery. It‘s very easy to use and changes  
> „document.getElementById('id')“ to „$('#id'). Anyways what I‘m  
> trying to do is this:
>
> document.getElementById(elem).className = "activeRow"
>
> Now I tried some debugging and found out eventually that this is  
> impossible. It‘s very easy with jQuery, and it handles all extra  
> stuff as keeping all other class names of an element with this  
> function $(elem).addClass("activeRow"). I know that the javascript  
> function being called inside the page, that is displayed in  
> Jx.Dialog I have running is logging some data and that appears in  
> the console.
>
> Now when I include the jquery file I get errors all over the place  
> „document.geteleement. ... style“ is not defined“ etc. And I was  
> wandering, does fusion not allow extra libraries to be used or is it  
> just too fragile to include something else ? Also does anyone have a  
> clue why I can‘t edit the className of this element ? I tried  
> setting it to null and firebug showed me it had no effect.
>
> Also, styling web pages inside a Jx.Dialog is not working as it  
> should in IE 7? Is this a known bug as well ?
>
> Regards
> Tómas.
> _______________________________________________
> fusion-users mailing list
> fusion-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fusion-users


__________________________________________

    Paul Spencer
    Chief Technology Officer
    DM Solutions Group Inc
    http://www.dmsolutions.ca/



More information about the fusion-users mailing list