我使用 GXT 3.0.5(商业许可证)。
当我用 a 创建一个网格时,我只在 ChromeGridInlineEditing
上有一些奇怪的错误:
- 使用
setCLicksToEdit(ONE)
,无法编辑列(编辑组件出现然后立即消失) - 使用,我可以编辑除包含: 的
setCLicksToEdit(TWO)
列之外的所有列,但是当我单击它时,编辑完成并且值不会更新。CheckBox
CheckBox
我用 Grid 创建了一个小例子,它多次显示这个 Bean :
public class MyBean {
private Integer id;
private String label;
private Boolean enabled;
public MyBean(Integer id, String label, Boolean enabled) {
this.id = id;
this.label = label;
this.enabled = enabled;
}
//Getters & Setters
}
以及对应的格子。我让它尽可能简单:
public class MyGrid extends Composite {
public interface MyPropertyAccess extends PropertyAccess<MyBean> {
ValueProvider<MyBean, Integer> id();
ValueProvider<MyBean, String> label();
ValueProvider<MyBean, Boolean> enabled();
}
public MyGrid(){
//Build columnModel
MyPropertyAccess propertyAccess = GWT.create(MyPropertyAccess.class);
ColumnConfig<MyBean, Integer> colId = new ColumnConfig<MyBean, Integer>(propertyAccess.id(),500, "ID");
ColumnConfig<MyBean, String> colLabel = new ColumnConfig<MyBean, String>(propertyAccess.label(), 500, "Label");
ColumnConfig<MyBean, Boolean> colEnabled = new ColumnConfig<MyBean, Boolean>(propertyAccess.enabled(), 500, "Enabled");
ColumnModel<MyBean> columnModel = new ColumnModel<MyBean>(Arrays.<ColumnConfig<MyBean,?>>asList(colId, colLabel, colEnabled));
//Create grid
Grid<MyBean> grid = new Grid<MyBean>(new ListStore<MyBean>(buildModelKeyProvider()), columnModel);
//Make it editable
GridInlineEditing<MyBean> inlineEditing = new GridInlineEditing<MyBean>(grid);
inlineEditing.addEditor(colLabel, new TextField());
inlineEditing.addEditor(colEnabled, new CheckBox());
inlineEditing.setClicksToEdit(ClicksToEdit.TWO);
//Fill store with dummy values
for(int i = 1;i<=30;i++){
grid.getStore().add(new MyBean(i, "Bean"+i, i%2==0));
}
this.initWidget(grid);
}
private ModelKeyProvider<MyBean> buildModelKeyProvider(){
return new ModelKeyProvider<MyBean>() {
@Override
public String getKey(MyBean item) {
return Integer.toString(item.getId());
}
};
}
}
我做错了什么还是 GXT 中有错误?
注意:我可以GridInlineEditing
用 a替换GridRowEditing
(它有效),但这不再满足用户的需要。
注意:在 Firefox 上,我有同样的问题,setCLicksToEdit(ONE)
但一切都很好setCLicksToEdit(TWO)