how to get the datagrid running?

2,166 views
Skip to first unread message

Dennis Haupt

unread,
Jul 26, 2012, 4:32:42 AM7/26/12
to google-we...@googlegroups.com
i tried to follow the example here:

but it doesn't even compile.
there is no implementation of the interface CwConstants, the field "constants" is final but never initialized and the method "onInitialize" has an override annotation but overrides nothing.
what am i missing?

if i skip all this and just try to get a simple datagrid running, all its cells are invisible, but i can see they exist in the generated source code.
is there another example that works?

Thomas Broyer

unread,
Jul 26, 2012, 5:36:30 AM7/26/12
to google-we...@googlegroups.com, d.ha...@googlemail.com

On Thursday, July 26, 2012 10:32:42 AM UTC+2, Dennis Haupt wrote:
i tried to follow the example here:

but it doesn't even compile.
there is no implementation of the interface CwConstants, the field "constants" is final but never initialized and the method "onInitialize" has an override annotation but overrides nothing.
what am i missing?

Some classes/interfaces are not really relevant to the example so they're not included in the "Source code" drop-down.
The Showcase full source code is in the GWT SDK though (in the "samples" directory), and can thus of course be found in the source repo: http://code.google.com/p/google-web-toolkit/source/browse/trunk/samples/showcase/
 
if i skip all this and just try to get a simple datagrid running, all its cells are invisible, but i can see they exist in the generated source code.
is there another example that works?

DataGrid is a RequiresResize, did you put it in a ProvidesResize container? (any kind of layout panel: RootLayoutPanel, DockLayoutPanel, LayoutPanel, etc.)
Alternately you can give it explicit dimensions (preferably in pixels). 

Dennis Haupt

unread,
Jul 26, 2012, 6:06:12 AM7/26/12
to Thomas Broyer, google-we...@googlegroups.com
still not working. my ui.xml is:

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder
 xmlns:ui="urn:ui:com.google.gwt.uibinder"
 xmlns:g="urn:import:com.google.gwt.user.client.ui"
 xmlns:c="urn:import:com.google.gwt.user.cellview.client">

<g:DockLayoutPanel
 unit="EM">
<!-- DataGrid. -->
<g:center>
<c:DataGrid ui:field='cellTable' visible="true"/>
</g:center>

<!-- Pager. -->
<g:south size="3">
<g:HTMLPanel>
<table style="width:100%">
<tr>
<td>
<c:SimplePager ui:field='pager' location="CENTER"/>
</td>
</tr>
</table>
</g:HTMLPanel>
</g:south>
</g:DockLayoutPanel>
</ui:UiBinder>

which is a copy of the showcase example.

it does show if i create everything manually:
cellTable = new DataGrid<Contact>(15);
pager = new SimplePager(SimplePager.TextLocation.CENTER);
DockLayoutPanel ret = new DockLayoutPanel(Style.Unit.PX);
initUIComponents();//configures columns, adds data
ret.addNorth(cellTable, 500);
ret.addSouth(pager, 100);
return ret;//is added to a rootlayoutpanel

but here, i cannot see the pager even though it's on the page.

if i use a vertical panel instead of a docklayoutpanel and a celltable instead of a datagrid, everything works as expected.

2012/7/26 Thomas Broyer <t.br...@gmail.com>

Dennis Haupt

unread,
Jul 26, 2012, 6:42:06 AM7/26/12
to Thomas Broyer, google-we...@googlegroups.com
another thing:
i can see my comparator is begin used when i click on a column header, but the sorting of the table does not change. also, the "sorted"-icon does not appear.
is there something secret i need to do before this works?

2012/7/26 Dennis Haupt <d.ha...@googlemail.com>

Dennis Haupt

unread,
Jul 26, 2012, 6:55:38 AM7/26/12
to Thomas Broyer, google-we...@googlegroups.com
i figured out why my components did not show. in the whole panel tree, there must no be a single non-layout-panel up to the rootlayoutpanel. once i made sure the chain was ok, the table was visible.
sorting still doesn't work.

2012/7/26 Dennis Haupt <d.ha...@googlemail.com>
Reply all
Reply to author
Forward
0 new messages