我使用GXT 3.0.5(商业许可证)。
当我使用GridInlineEditing
创建网格时,我在仅限Chrome 上有一些奇怪的错误:
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
替换为GridRowEditing
(可行),但这不符合用户的需求。
注意:在Firefox上,setCLicksToEdit(ONE)
我遇到了同样的问题,setCLicksToEdit(TWO)
答案 0 :(得分:1)
查看http://dev.sencha.com/deploy/ext-4.0.0/examples/grid/row-editing.html 这是一个较新的GXT版本,但是当您提交更改时,您可以看到复选框不会更新。这似乎是GXT中的一个错误。
这个问题可以帮助您解决第一个问题:http://www.sencha.com/forum/showthread.php?266458-GridInlineEditing-fires-blur-event-immediately-after-cliking