【发布时间】:2011-01-12 19:29:20
【问题描述】:
我们正在使用 SmartClient GWT 库(请参阅 Smartclient GWT showcase here)。
我正在尝试制作一个 ListGrid UI,当您单击记录时,字段变得可编辑。就像例子一样:
不同之处在于我使用自己的自定义 GWT RPC 服务并手动将 ListGridRecord 添加到我自己的数据源中,我看到我的记录出现了,但单击时这些字段不可编辑。我使用GWTRPCDataSource implementation 创建了一个自定义数据源并正确覆盖了executeFetch 方法。
使用创建 ListGridRecords 的示例 XML 数据源是否正在进行一些特殊处理,将其正确设置为可编辑?
例如,我使用 CountryXMLDS.java 就像示例一样,只是我添加了一条自定义记录(并且我已经删除了所有字段,但我希望可编辑的人口字段除外)。我看到我的记录出现了,但单击记录时该字段不可编辑。
ListGridField populationField = new ListGridField("population", "population");
populationField.setType(ListGridFieldType.INTEGER);
populationField.setCanEdit(true);
countryGrid.setFields( populationField);
countryGrid.setCanEdit(true);
countryGrid.setEditEvent(ListGridEditEvent.CLICK);
ListGridRecord record = new ListGridRecord();
record.setAttribute("population", "5");
CountryXmlDS.getInstance().addData(record);
【问题讨论】:
-
它似乎在我的机器上正常工作,您能否提供有关您的 countryGrid 的更多详细信息?您使用哪个版本的 smartgwt? populationField.setCanEdit(true) 不是强制性的。
标签: javascript data-binding gwt datasource smartgwt