1

I'm having problems using ResizeLayoutPanel inside DisclosurePanel.

I have a Datagrid into ResizeLayoutPanel, and ResizeLayaoutPanel inside DisclosurePanel. The problem is when data is loaded, If DisclosurePanel was closed, when user opens disclosurePanel it finds the table empty. If user does this action when DisclosurePanel is open, works fine.

Any idea how can I solve this problem?

This is the code:

ResizeLayoutPanel resizeLayoutPanel = new ResizeLayoutPanel();

    resizeLayoutPanel.setWidth("100%");
    resizeLayoutPanel.setStyleName("gwt-resizeLayoutPanel-Example");

    /****CREATE COLUMNS [BEGIN] ***************************************************************************/
    // Create column.
    TextColumn<Object> column = new TextColumn<Object>() {
        @Override
        public String getValue(Object object) {
            return "Test";
        }
    };
    /******CREATE COLUMNS [END] ***************************************************************************/


    cellTable = new DataGrid<Object>();
    cellTable.addColumn(column, "Example");
    cellTable.setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.BOUND_TO_SELECTION);
    cellTable.setWidth("100%");
    cellTable.setEmptyTableWidget(new Label("Example table"));

    resizeLayoutPanel.add(cellTable);

    //Link dataProvider with CellTable
    dataProvider.addDataDisplay(cellTable);

    this.container = ModuleContainer.getAdvancedDisclosurePanel("Samples");
    this.container.setWidth("100%");
    this.container.setContent(resizeLayoutPanel);

    return this.container;
Javier C
  • 101
  • 1
  • 10

1 Answers1

0

ResizeLayoutPanel provides resize (implements ProvidesResize) but does not requires resize (does not implement RequiresResize).

Since ResizeLayoutPanel in its plain state does not listen to resize, you have to deliberately resize it, or write code to resize it. Perhaps, set width and height to 100%.

And then, why did you place the table inside a ResizeLayoutPanel ?

ResizeLayoutPanel provides resize to widgets that RequiresResize. You need to extend the celltable to implement RequiresResize, so that the ResizeLayoutPanel would be able to resize it.

The first concept anyone needs to learn when programming GWT is to understand why/how to create a chain/tree of unbroken RequiresResize-RequiresResize from a root resize panel. If your root of your resize chain/tree is not RootLayoutPanel, then you have to deliberately resize that root.

In this case, you have made ResizeLayoutPanel the root of resize non-existent resize chain. Use another panel that implmements RequiresResize so that it could be resized by a parent - as well as making sure the parent is resizable manually by user or by another resizable parent.

May I ask you to ask yourself, what is the reason for using ResizeLayoutPanel without providing a way to resize it and also without using it as a root of a resizing chain?

Blessed Geek
  • 21,058
  • 23
  • 106
  • 176
  • 1
    Thank you for answer my question. I have placed GridTable inside a ResizeLayoutPanel because If did not place the table inside this Panel, table would not visible. The problem was solved calling redraw method when the panel is opening. I do not know if this the correct way to do that. – Javier C Sep 19 '12 at 15:20