Ext-GWT / GXT (wrong) Simple layout problem?

I posted this question on Ext-GWT forums, I just hope someone here can have an answer for me!

I'm struggling to do what I originally thought was simple, but I'm starting to think it's impossible ...

I have a layout template that consists of several GWT DockLayoutPanel inside each other and finally ends with LayoutPanels. GWT LayoutPanel is designed to ensure that the size of the widget (or composite) that was added to it in full size, and goes well with clean GWT widgets.

The idea of ​​my “layout template” is that I don't know the EXACT height and width of the innermost LayoutPanel, because I can set some panel sizes (external DockLayoutPanels) differently when instantiating this template. All I would like to add is the Grid component to one of the innermost LayoutPanels and have its size (height and width) so that they match normal GWT widgets (works fine with the GWT shortcut, for example).

I am VERY new to GXT (since I started using it earlier today), and I really understand that GXT builds its Components differently the way GWT creates its Widgets in the DOM.

In any case, in order to achieve the desired result? I tried to add a grid to ContentPanel with FitLayout layout, I tried AnchorLayout, I tried to add a grid directly ... Nothing works ... Any tips or even a push in the right direction would be greatly appreciated!

Thanks in advance!

Xandel

+3
source share
2 answers

Just a note on this post and the direction I took. When I started my GWT project and I studied the basics and read other posts, worries and tips, one of the tips that I overlooked from the beginning was pretty simple - when using the GWT infrastructure, use only 100% of the GWT components.

-, " , , , , - ". .

, , GWT . , , , , , , , (, , JSON-) (, ) .

, . . ext-gwt, gwt-ext, gwt-mosaic gwt-. , , GWT ( , , , , ). , , . , , let-me-find-a-useful-component.

, , , . - . (, , , ). - , ( ). , , (, , , ), , - , , onSizeKnown (int width, int height) .

, . , GWT . , , .

, GWT , (?), , - - , ​​ - . . , . , , , , GWT . , .

Xandel

+11
  • GXT 2.2.0 GWT 2.0.4 *

, , , - .

, GXT Grid GWT LayoutPanel. , / . , , , , 0, , ( ).

, , , GXT , GWT. :

class MyGridWrapper extends Composite {

  private LayoutPanel widget;
  private Grid<?> grid;

  public MyGridWrapper(Grid<? extends ModelData> grid) {
    this.grid = grid;

    widget = new LayoutPanel();
    initWidget(widget);

    widget.add(grid);
    // Set the grid vertical and horizontal constraints

    // ... populate the rest of the panel
  }

  @Override
  protected void onLoad() {
    // onLoad is called after GXT is finished so we can do what we need to

    // Redo what the LayoutPanel did originally
    grid.el().setStyleAttribute("position", "absolute");
    grid.el().setStyleAttribute("top", "0");
    grid.el().setStyleAttribute("bottom", "0");
    grid.el().setStyleAttribute("left", "0");
    grid.el().setStyleAttribute("right", "0");

    // Undo any height settings on the .x-grid3 element
    El mainWrap = grid.el().firstChild();
    assert mainWrap.hasStyleName("x-grid3") : "Wrong Element: " + mainWrap.getStyleName();
    mainWrap.setStyleAttribute("height", "auto");

    // Undo any height settings on the .x-grid3-scroller element
    El scroller = grid.el().firstChild().firstChild().getChild(1); // FUN!
    assert scroller.hasStyleName("x-grid3-scroller") : "Wrong Element: " + scroller.getStyleName();
    scroller.setStyleAttribute("height", "auto");
  }
}

, , , , , , GIANT, GIANT hack.

-

  • , Grid Grid, JX GXT com/extjs/gxt/ui/client/widget/grid/GridTemplates # master.html

  • com.extjs.gxt.ui.client.widget.grid.GridView # renderUI(), , .

+2

Source: https://habr.com/ru/post/1744429/


All Articles