문제

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