gpt4 book ai didi

java - GXT 与 GridInlineEditing 的奇怪行为

转载 作者:行者123 更新时间:2023-12-01 14:17:30 25 4
gpt4 key购买 nike

我使用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 中有错误吗?

注意:我可以替换 GridInlineEditingGridRowEditing (它有效)但这不再满足用户的需求。

注意:在 Firefox 上,我也遇到了与 setCLicksToEdit(ONE) 相同的问题。但 setCLicksToEdit(TWO) 一切都很好

最佳答案

看看这个 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

关于java - GXT 与 GridInlineEditing 的奇怪行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17990630/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com