DataGrid (GWT 2.4) not visible in HTMLPanel

2,547 views
Skip to first unread message

Uemit

unread,
Sep 19, 2011, 12:33:12 PM9/19/11
to google-we...@googlegroups.com
I am trying to switch from CellTable to the GWT 2.4's new DataGrid CellWidget however I run into a problem. 
I used the CellTable inside two normal divs for styling purposes (border, etc). 
The UiBinder code looked as follows:

<g:HTMLPanel>
<div class="{mainRes.style.box_shadow}">
   <div class="{mainRes.style.box_container}">
           <c:CellTable ui:field="table" addStyleNames="{mainRes.style.cellTable}" />
           </div>
       </div>
</g:HTMLPanel>

However with the new DataGrid this approach doesn't work anymore.  When I put the DataGrid inside a HTMLPanel, nothing is displayed. I checked with firebug and I saw that height is 0px. 
I then checked the DataGrid source and saw that it implements the RequireResize interface. So I assume the problem is that HTMLPanel breaks the  ProvidesResize chain. 
I tried to set the height to 100% but it didn't really work.
Is it somehow possible to put the DataGrid inside two normal "divs" or can I only place it inside a <g:LayoutPanel> ? 

Thanks in advance

Ümit

Steve Wall

unread,
Sep 19, 2011, 4:40:34 PM9/19/11
to google-we...@googlegroups.com
I had the same problem a couple weeks ago.  Yes, DataGrid must display in one of the Layout Panel classes as it needs the ProvidesResize interface you describe.  You may want to try the ResizeLayoutPanel, which allows a single child widget.

Uemit

unread,
Sep 22, 2011, 11:33:12 AM9/22/11
to google-we...@googlegroups.com
@Steve: 
Thanks for the confirmation. I put the DataGrid in a ResizeLayoutPanel and it works fine now. 

Emac

unread,
Oct 25, 2011, 3:02:03 AM10/25/11
to Google Web Toolkit
Hello, I have the same issue. But if I don't set a size in pixeles the
data grid is hidden. Could you tell me what do you do?

Thanks

Emanuel

Thomas Broyer

unread,
Oct 25, 2011, 6:36:53 AM10/25/11
to google-we...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages