Thursday, July 26, 2012

Re: how to get the datagrid running?

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.broyer@gmail.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). 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment