Reputation: 6237
let's say I have a code like this
Grid g = new Grid(2,2);
Label l = new Label("Hello");
g.setWidget(0,1, l);
s.setColspan(0,1,2); // there is no such method :(
So how can I set rowspan and colspan values on gwt Grid cell containing a widget?
Upvotes: 13
Views: 28307
Reputation: 241
There is a not-so-simple-solution to this. It works by manipulating directly the DOM.
Grid g = new Grid(10, 5);
Element e = g.getCellFormatter().getElement(0, 0);
e.setAttribute("colspan", "5");
ArrayList<Element> toRemove = new ArrayList<Element>();
for (int x=1; x<5; x++)
toRemove.add(g.getCellFormatter().getElement(0, x));
for (Element f : toRemove)
f.removeFromParent();
It does following:
Please note, that I used to for-loops. I tried it with one single loop but some of the elements were NULL, so I tried it this way and it worked.
Thomas
Upvotes: 8