Friday, May 28, 2010

Re: How to add an Element object into a Widget.

Any particular reason not to just use the Grid widget? The overhead
is negligible and the code a lot simpler..

On May 28, 5:08 am, Rizen <vianney.dep...@gmail.com> wrote:
> Hello,
>
> For my project, I would like to create a table in HTML by means of the
> DOM tree.
> For this, I'm just using the functions DOM.createTable(),
> DOM.createTBody(), DOM.createTR()...
> However the generated table is an Element type.
>
> Except that I'm using the MVP as a pattern for my application. So I
> have to init the main Widget with the function initWidget(), which
> takes a Widget object as parameter. I was looking for a panel like the
> HTMLPanel but no method can change or add an Element into a Widget.
>
> Is there a method that I can use to cast the Element object in Widget
> object ?
>
> Here is an example of code :
>
> public class View extends Composite {
>
>         public View() {
>                 Element table = DOM.createTable();
>                 Element tbody = DOM.createTBody();
>                 Element tr = DOM.createTR();
>                 Element td = DOM.createTD();
>
>                 tr.appendChild(td);
>                 tbody.appendChild(tr);
>                 table.appendChild(tbody);
>
>                 // Need a Widget as a type
>                 initWidget(table);
>         }
>
> }

--
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