I notices, that there is still something going wrong. I colored the
boxes to see if the inner boxes are really located in the outer ones,
but it's not working. I think the problem is, that I get tableOuter
and not tableInner by calling the following lines in addInner():
Cell cellForEvent = tableOuter.getCellForEvent(event);
tableInner = (FlexTable) tableOuter.getWidget(cellForEvent.getRowIndex
(), 0).getParent();

On Aug 15, 11:42 am, Tobe <[email protected]> wrote:
> Thanks Ian, now, it works
> I used this snippet of code in addInner() to get the corresponding
> inner FlexTable:
>
> Cell cellForEvent = tableOuter.getCellForEvent(event);
> tableInner = (FlexTable) tableOuter.getWidget(cellForEvent.getRowIndex
> (), 0).getParent();
>
> On Aug 14, 8:45 pm, Ian Bambury <[email protected]> wrote:
>
>
>
> > Presumably you know where they are, so you can do something like:
>
> > FlexTable levelTwoFlexTable = (FlexTable) levelOneFlexTable.getWidget(row,
> > column);
>
> > BTW, though I'm not sure why you are getting your exceptions, here''s a way
> > to add rows anywhere - you'd need two versions - one for adding a level-2
> > flextable to a level-1 flextable, and another to deal with adding rows to
> > your level-2 flextable. And you'd probably be better off with labels styled
> > as links rather than buttons...
>
> > import com.google.gwt.event.dom.client.ClickEvent;
> > import com.google.gwt.event.dom.client.ClickHandler;
> > import com.google.gwt.user.client.ui.Button;
> > import com.google.gwt.user.client.ui.FlexTable;
> > import com.google.gwt.user.client.ui.Label;
>
> > public class AddRowButton extends Button implements ClickHandler
> > {
> >     private static int c = 0;
>
> >     public AddRowButton()
> >     {
> >         super("Add Row Here");
> >         addClickHandler(this);
> >     }
>
> >     @Override
> >     public void onClick(ClickEvent event)
> >     {
> >         Button b = (Button) event.getSource();
> >         FlexTable f = (FlexTable) b.getParent();
> >         int r = f.getCellForEvent(event).getRowIndex();
> >         f.insertRow(r);
> >         f.setWidget(r, 0, new AddRowButton());
> >         f.insertRow(r + 1);
> >         // Change the next line so it adds a level-2 flextable
> >         f.setWidget(r + 1, 0, new Label("Level 2 Flextable " + ++c + "
> > here"));
> >     }
>
> > }
>
> > If you want to try it, then all you need is the following in your
> > onModuleLoad()
>
> >         FlexTable f = new FlexTable();
> >         f.setWidget(0, 0, new AddRowButton());
> >         RootPanel.get().add(f);
>
> > Ian
>
> >http://examples.roughian.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to