简体   繁体   English

GWT中数据网格的按钮小部件

[英]Button widget to datagrid in GWT

I am new to GWT. 我是GWT的新手。 I have implemented datagrid successfully. 我已经成功实现了datagrid。 Now I want to add a Button/Checkbox widget to the datagrid. 现在,我想向Datagrid添加一个Button / Checkbox小部件。 I have gone through many sites but couldn't find the exact solution. 我已经浏览了许多站点,但是找不到确切的解决方案。 Hopefully I get the solution hear. 希望我能听到解决方案。

One doesn't add widgets to cell -based widgets. 不会将小部件添加到基于单元格的小部件中。

For buttons you have several choices: 对于按钮,您有几种选择:

  • ActionCell , with a fixed message and using a delegate to react to clicks 带有固定消息并使用委托对点击做出反应的ActionCell
  • ButtonCell , whose text can vary for each row (uses the Column 's getValue ) and using FieldUpdater to communicate clicks ButtonCell ,其文本可以针对每一行而变化(使用ColumngetValue ),并使用FieldUpdater来传达点击
  • TextButtonCell , similar to ButtonCell but uses the appearance pattern (also used by Sencha GXT btw) so you can customize the rendering (default appearance is a native button) TextButtonCell ,与ButtonCell相似,但使用外观模式 (也由Sencha GXT btw使用),因此您可以自定义呈现(默认外观是本机按钮)

For checkboxes, use the CheckboxCell . 对于复选框,请使用CheckboxCell Depending on whether you're using it to edit a boolean value or to select the rows, you'll use one constructor or the other, and possibly a selection event manager . 根据您使用它来编辑布尔值还是选择行,将使用一个构造函数或另一个构造函数,还可能使用选择事件管理器

You'll find examples of use in the Showcase app: 您将在Showcase应用中找到使用示例:

  • Cell Sampler shows you buttons (not the TextButtonCell though) and how to edit a boolean value with a checkbox. 单元格采样器显示按钮(而不是TextButtonCell )以及如何使用复选框编辑布尔值。
  • Cell Table and Data Grid show how to use a checkbox to control selection. 单元格表数据网格显示如何使用复选框来控制选择。

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

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