0
votes

I am creating a GWT app with a DataGrid. The DataGrid hierarchy is:

RootLayoutPanel->DockLayoutPanel->DockLayoutPanel->LayoutPanel->DockLayoutPanel->DockLayoutPanel->DataGrid

Apart from the adding to RootLayoutPanel, the structure is all defined in uiBinder XML

The DataGrid is included in the XML using the following code

<g:ScrollPanel>
    <c:DataGrid ui:field='ownershipGrid' visible="true"/>
</g:ScrollPanel>

In my view I have

    @UiField
    DataGrid<OwnershipInformation> ownershipGrid;

    ...

    ownershipGrid = new DataGrid<OwnershipInformation>(OwnershipInformation.KEY_PROVIDER);
    ownershipGrid.setMinimumTableWidth(140, Style.Unit.EM);           
    ownershipGrid.setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy                                                         .KeyboardSelectionPolicy.ENABLED);

    ... add comlumns to ownershipGrid ...

   ownershipInformationList.addDataDisplay(ownershipGrid);

However, I still don't get my table to show. I have called ownershipGrid.getRowCount() and it shows as having 6 rows, so I know that data is there. The panels in which the DataGrid is contained are all visible.

Regards, Richard


The problem is that after adding the DataGrid in the uiBinder, I then call new and point the private variable to a different DataGrid that isn't being displayed.

1
I think that DataGrid has a built-it scroll panel. Did you try without the wrapping ScrollPanel?David Levesque
I thought so to Akkusativobjekt, so I have already trawled the existing questions. The hierarchy is all layout panels, I add the data source last, and I have tried adding a size and calling redraw. I don't even get headers being shownRichard George
I have also now added an empty comment that also doesn't get shown. In the generated HTML I do see several Tables in the right place in firebug, but nothing in themRichard George

1 Answers

0
votes

You've forgot to declare the grid provided:

@UiField DataGrid<OwnershipInformation> ownershipGrid;

should be:

@UiField(provided=true) DataGrid<OwnershipInformation> ownershipGrid;