GWT FlexTable 按钮问题
我正在检索 List
,我想将其显示在 Flex 表中。此外,对于 Flex 表中的每一行,我都需要一个删除按钮。单击删除按钮应从 Flex 表中删除该行。
所以我编写的代码类似于
for(int i =0 ;i < strings.size();i++) {
flexTable.setWidget(i,0,strings.get(i));
flexTable.setWidget(i,1,new Button("X");
}
现在我使用 MVP 架构来编写此代码。我指定这一点的原因是我希望在我的视图中声明的所有小部件和单击处理程序都在我的演示者中。
一般来说,如果我的视图中有 Button b = new Button("Sample Button");
我可以有一个 getter 方法并使用 getButton.addClickHandler(new ClickHandler())
在我的主持人中。 但在这里我正在动态创建删除按钮。
那么我如何为删除按钮和 onClick 分配一个单击处理程序,我应该能够从 flextTable 中删除该行。
谢谢
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.
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.
Generally if i have Button b = new Button("Sample Button");
in my View
I can have a getter method and use getButton.addClickHandler(new ClickHandler())
in my presenter.
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.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需在视图中注册处理程序,并从接收每个删除的字符串的演示者提供回调类型类。
Just register the handlers in the View and provide a Callback type class from the Presenter that receives each String that is deleted.