I'm using a layout panel with some layers. One of the layers is quite simple but I want it to have a float: right on the element. But this is actually not working because subwidgets are styled with style="postition: absolute; left: 0px; ..."
which overrides the styling and so the subpanels/widgets will always be placed on the left. Any workaround for this?
Asked
Active
Viewed 296 times
0

Dennis Ich
- 3,585
- 6
- 27
- 44
1 Answers
1
After adding your element to your layout container, did you try setWidgetHorizontalPosition ?
If above method does not work and you want to use float right, maybe you can use a non-layout system with FlowPanel maybe. Otherwise you will have to fix the position and width/height of your components but you may loose responsive design.
Last trick : If you really need to change the absolute style. In your component do something like this (do this after your component has been added to the dom)
this.getElement().getParent().getStyle().set.....
You can reset whatever property you want but this might break your layout

Ronan Quillevere
- 3,699
- 1
- 29
- 44
-
I agree. Layers should not float. If you need float, use a FlowPanel. – Andrei Volgin Feb 04 '14 at 02:20
-
Its not really a float i want them to be aligned at the right and not at the right side. Actually I have a kind of menu bar with 3 different cells (left, middle, right) while the right one should be also aligned at the right side. Wrapping the Widgets inside the layer into a FlowPanel and then setting them to float: right actually also works but I don't think thats an intended solution though. – Dennis Ich Feb 04 '14 at 12:50
-
so use setWidgetRightWidth with 0 for right (but need the width of your "cell") – Ronan Quillevere Feb 04 '14 at 13:36
-
Is the relative width enough for that? – Dennis Ich Feb 04 '14 at 14:18
-
Relative width ? I do not understand what you mean. Either you define the width of your component in px and it will be fixed for ever, either you set a % and your design will be responsive. "relative" notion is linked to positioning in css. – Ronan Quillevere Feb 04 '14 at 17:03