widget remove itself

2019-08-26 22:16发布

问题:

i have widget like below

in ui.xml

 textbox, anchor_delete 

when anchor_delete is press, @uihandler fired and i want entire widget textbox and anchor_delete remove itself from the view. Is this possible

@UiHandler("anchor_delete")
void deleteRowAction(ClickEvent event) {

   getWidget().removeFromParent(); //i tried this but fail
}

回答1:

Did you try:

textbox.removeFromParent();
anchor_delete.removeFromParent();

Assuming both are widgets.