0

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.

George Stocker
  • 57,289
  • 29
  • 176
  • 237
  • 2
    I think that DataGrid has a built-it scroll panel. Did you try without the wrapping ScrollPanel? – David Levesque Oct 22 '13 at 00:00
  • Maybe a similar problem : http://stackoverflow.com/questions/12173108/gwt-datagrid-does-not-show-data-but-contains-it – Akkusativobjekt Oct 22 '13 at 08:22
  • 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 shown – Richard George Oct 22 '13 at 14:04
  • 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 them – Richard George Oct 22 '13 at 14:32

1 Answers1

0

You've forgot to declare the grid provided:

@UiField DataGrid<OwnershipInformation> ownershipGrid;

should be:

@UiField(provided=true) DataGrid<OwnershipInformation> ownershipGrid;
Fedy2
  • 3,147
  • 4
  • 26
  • 44