سؤال

I want to set Ui:Field name for HTML tag (not Google Widget), something like this:

in my UiBinder file

<g:HTMLPanel>
   <table> <tr ui:field="myRow"><td>Test</td></tr></table>
</g:HTMLPanel>

And my View.java

@UiField Tr myRow;

Can we do this? how to do it properly?

I also want to hide the Tr after clicking hideRow button & how to do that?

هل كانت مفيدة؟

المحلول

In your Java, list it as

@UiField
TableRowElement myRow;

or just as

@UiField
Element myRow;

This is documented at http://www.gwtproject.org/doc/latest/DevGuideUiBinder.html#Hello_World - see the SpanElement called nameSpan or the DivElement called root.

Edit to answer hiding issue added after question was posted:

There isn't a built-in way to hide an Element, but you can manipulate the element in GWT/Java the same as you would in JS, something like this:

myRow.getStyle().setDisplay(Display.NONE);

Other ways to set this include visibility:hidden, or just removing it from its parent element.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top