PDA

View Full Version : Gxt and extjs on the same page (body classes get overwritten)



korebantic
14 Jan 2009, 10:31 AM
I'm in a situation where I have a page that is rendered with extjs, but includes a gxt component. In this scenerio, gxt is overwriting the body classes injected by extjs.

This is a snippet of the body element on a page that uses extjs only:

<body class="ext-gecko ext-gecko3 x-border-layout-ct" id="ext-gen7" style="position: relative;">

This is a snippet of the body element on the same page above, that uses extjs and gxt (where gxt renders a panel to a specified div):

<body class="ext-gecko" id="ext-gen7" style="position: relative;">

You can see that gxt is overwriting the class attribute. Is there an easy way to control this behavior in gxt? This is arguably a bug, because if my gxt code is ony rendering to a div within the body, it's a bit naughty for gxt to be overwriting classes in body. Also, if anything, shouldn't it not be appending the classes versus overwriting?

Auz
11 Feb 2009, 3:57 PM
I've encountered the same issue.
My body class that is defined in my own linked css file, gets replaced by the gxt css class when the gxt component gets loaded.
Is there a workaround for this?

Auz
11 Feb 2009, 5:09 PM
I managed to work around this by letting GXT set the body class and I wrapped my original body in a div element and then applied my css class to this div element instead.
Unfortunately this may not help you if your two body class modifiers are automatically generated.

korebantic
11 Feb 2009, 6:14 PM
Take a look at the GXT.java class (package com.extjs.gxt.ui.client) function init(). Almost at the end of it there is the following evil line:

"XDOM.getBody().setClassName(cls);"

You will need to patch this so that it at the least appends to the body instead of overwriting, and then recompile and create a new Jar.

Auz
12 Feb 2009, 2:35 PM
I would have thought something like this was handled out of the box,
Nice hack nevertheless, thanks mate.

sven
12 Feb 2009, 2:53 PM
I did the change.

Auz
12 Feb 2009, 3:54 PM
Thanks Sven, how can access the new jar?

sven
12 Feb 2009, 3:55 PM
You cant right now. As soon as it is in SVN you would be able to get it with a support subscription


http://extjs.com/store/gxt/#support-table