tags:

views:

711

answers:

3

I have an element in GWT.I want it to float right .I have used - DOM.setStyleAttribute(element, "float", "right");-which is not working .I am not sure if I am using correct arrtibute('float').Please advise.Thanks in advance

+1  A: 

Ok this begs the obvious question... why aren't you using GWT layout to do this? That's kinda the point of GWT is to (at least in part) abstract CSS positioning/layout. Or, rather, to use the more familiar desktop GUI layout models (BoxLayout, GridLayout and so forth).

cletus
This question I asked raised from need.Every layout you use in gwt results in table(there are few exception) .And if in a view you render many tables it takes a long time in IE.So using float I wanted to haave a two column looks of a table .
Ratn Deo--Dev
Then you're using the wrong tool. Round peg, square hole.
cletus
yes, round peg, square hole, but that also begs the question, why isnt GWT more flexible in this regard? or why is gwt wigets internally use floats/css/divs to position and layout, instead of using tables? Dont get me wrong, i am a fan of gwt, but lately i m seeing its limitations.
Chii
Because GWT is representing complex layout through a cross-browser abstraction model and the only way to do complex layout with things like vertical centering is, like it or not, with tables. If you're not buying into the "GWT way" you're using the wrong technology.
cletus
Perhaps you're more interested in a Javascript framework?
cletus
I like GWT but at a time you have to do work around to accomodate changes
Ratn Deo--Dev
A: 

My thought here would be that you solve this in a static XHTML and CSS file approach. Then once you have it working there, you can transpose that into a gwt approach.

With the GWT approach I would still promote the philosophy of styling and presentation remain in the CSS file, static structure remains in the host HTML file, and dynamic widget placement occurs in the GWT code.

Worth reminding (or mentioning) that as you layout these DIVs and SPANs to use ids, to help you locate that element within your GWT code and populate it with your dynamic controls. Of course, the use of "class" in the element definitions to improve the CSS you will use to perform the float.

hoshposh
+1  A: 

The correct way to float is with "cssFloat" property:

DOM.setStyleAttribute(element, "cssFloat", "right");

"float" is a reserved keyword in javascript.

Miguel Ping