简体   繁体   English

GWT FlexTable按钮问题

[英]GWT FlexTable Button Problem

I am retrieving a List<String> strings from my database and i would like to display it in a Flex Table.Also with every row in the flex table i want a delete button.The delete button on click should remove the row from the flex table. 我正在从数据库中检索List<String> strings ,我想将其显示在Flex表中。此外,对于弹性表中的每一行,我都希望有一个删除按钮。单击删除按钮应从flex中删除该行表。

so i write code some thing similar to 所以我写代码类似于

for(int i =0 ;i < strings.size();i++) {

flexTable.setWidget(i,0,strings.get(i));
flexTable.setWidget(i,1,new Button("X");

}

Now i am using MVP architecture to write this code.The reason why i am specifying this is i want all the widgets declared in my View and the click handlers to be in my presenter. 现在我正在使用MVP架构来编写此代码。之所以要指定此代码,是因为我希望在View中声明的所有小部件以及单击处理程序都在我的演示者中。

Generally if i have Button b = new Button("Sample Button"); 通常,如果我有Button b = new Button("Sample Button"); in my View 在我看来

I can have a getter method and use getButton.addClickHandler(new ClickHandler()) in my presenter. 我可以使用getter方法,并在演示者中使用getButton.addClickHandler(new ClickHandler()) But here i am creating delete buttons on fly. 但是在这里我正在动态创建删除按钮。

So how can i assign a click handler to the delete Button and onClick i should be able to remove the row from the flextTable. 因此,如何将点击处理程序分配给Delete Button和onClick我应该能够从flextTable中删除该行。

Thanks 谢谢

只需在View中注册处理程序,然后从Presenter提供一个Callback类型类即可接收每个删除的String。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM