css - GWT FlowPanel not adding widget -


i have class extends flowpanel. add datagrid widget , grid widget this:

datagrid.setwidth("100%"); datagrid.setheight("100%");  grid.setwidth("100%"); grid.setheight("100%");  this.add(datagrid); this.add(grid);  this.setwidth("100%"); this.setheight("100%"); 

only datagrid widget appears. i've tried both switching flowpanel verticalpanel , wrapping grid in flowpanel, no joy. tried putting datagrid , grid 2 row, 1 column grid , didn't display anything. gwt 2.6.0 on safari.

i suspect have misunderstanding of setheight() , setwidth() doing in case, i'm not sure. there way see gwt thinks it's doing in terms of layout?

thanks.

you tell datagrid take available space inside flowpanel. tell grid widget same. result grid has height of zero, since there no space left after datagrid took 100% of flowpanel height.

you either have use "50%" heights, or make datagrid fixed size ("100px") , tell grid take rest. easiest way achieve use layoutpanel, , then, example:

layoutpanel.setwidgettopheight(datagrid, 0, unit.px, 100, unit.px); layoutpanel.setwidgettopbottom(grid, 100, unit.px, 0, unit.px); 

edit:

this code use resize datagrid:

public void resize(final boolean addheader, final boolean addfooter) {     scheduler.get().scheduledeferred(new scheduledcommand() {          @override         public void execute() {             // 37 height of header , footer based on css             int height = addheader ? 37 : 0;             if (addfooter) {                 height += 37;             }             (int = 0; < getrowcount(); i++) {                 height += getrowelement(i).getoffsetheight();             }             setheight(height + "px");         }     }); } 

if use approach, add datagrid flowpanel, , add grid flowpanel. call resize() on datagrid, , not set height or width on datagrid or grid.

for finer control @ flex-box layout model. supported in modern browsers.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -