Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    added GWT Widgets can't use percent size

    If you have a gwt widget that is set to a percentage, since the widget has no set px size and there's auto generated intermediary divs above that have no size indicated, the widget doesn't display(size:0px).

    The html you end up with is like this:

    Code:
    <div id="isc_D6" class="normal" onscroll="return isc_SGFusionWidget_0.$lh()" style="position: absolute; left: 0px; top: 0px; width: 350px; height: 450px; z-index: 203168; -moz-box-sizing: border-box; overflow: hidden; cursor: default;" eventproxy="isc_SGFusionWidget_0">
        <div id="isc_D7" style="POSITION:relative;VISIBILITY:inherit;Z-INDEX:203168;CURSOR:default;" eventproxy="isc_SGFusionWidget_0">
            <div id="isc_D8" class="hokeyZ" onscroll="return isc_WidgetCanvas_4.$lh()" style="position: absolute; left: 0px; top: 0px; width: 175px; height: 225px; z-index: 203186; -moz-box-sizing: border-box; overflow: hidden; cursor: default;" eventproxy="isc_WidgetCanvas_4">
                <div id="isc_D9" style="position: relative; visibility: inherit; z-index: 203186; cursor: default;" eventproxy="isc_WidgetCanvas_4">
                    <div id="isc_WidgetCanvas_4_widget" style="width:100%;height:100%">
                        <div id="0.28370684173338534" style="width: 50%; height: 50%;">
    The important part is right here:
    Code:
                <div id="isc_D9" style="position: relative; visibility: inherit; z-index: 203186; cursor: default;" eventproxy="isc_WidgetCanvas_4">
                    <div id="isc_WidgetCanvas_4_widget" style="width:100%;height:100%">
    The second div is stock generated in a getInnerHTML call in WidgetCanvas and sets the width and height to 100%. But that doesn't really matter because the first div, which can't be accessed directly in the SmartGWT api, has no size.

    It looks like setting percentages through the smartgwt api normally turns everything into actual px measurements, so the sizeless divs don't matter in normal smartgwt code, but if actual percentages are used in non smartgwt code, it fails.

    Even if the intermediate divs had 100% size, this would still give the wrong percentage, as the 50% is being added twice, once in the actual smartgwt widget, and a second time when the widget canvas is set to 50% of it's parent (where the percent turned into an actual px measurement), so the widget actually ends up at 25% size.

    #2
    Yes, core GWT widgets try to depend on native HTML layout, and this won't work. Instead, if you are forced to embed core GWT inside SGWT widgets, use events such as Resized to explicitly size the GWT widgets whatever way you want.

    Comment


      #3
      The library I'm using is the aurora smartgwt client for fusion charts. This creates a gwt wrapper which is placed in a smartgwt canvas(and indirectly inside a WidgetCanvas).

      Fusion Charts relies on the size of the parent div for resizing. There isn't a way to programmatically set the size of the chart after initialization, either in the client or directly in fusion charts as far as I can tell.

      As it stands there's a gwt widget inside a smartGwt widgetcanvas. I can't change the size of the chart itself. Changing the size of the smartgwt canvas and widgetCanvas doesn't do anything. I need to change the size of the gwt widget between the widgetcanvas and the chart. Presumably I would do this on in addResizedHandler on the smartgwt canvas.

      How am I supposed to access the gwt widget from the widgetcanvas, if the widget in the WidgetCanvas is private?

      Comment


        #4
        Auto-wrapping via WidgetCanvas isn't your only option. See the DOM Integration overview doc.

        Comment

        Working...
        X