从 DMI 数据源设置 SmartGWT TreeGrid 数据
我正在从 SmartGWT DMI 数据源获取数据,但无法让该数据显示在树中。有没有某种方法可以指定返回数据后树中应显示的内容?
final TreeGrid treeGrid = new TreeGrid();
treeGrid.setWidth(260);
treeGrid.setHeight(555);
treeGrid.setShowRoot(true);
DSRequest req = new DSRequest();
req.setOperationId("fetchData");
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("param1", "value1");
paramMap.put("param2", "value2");
req.setData(paramMap);
treeGrid.setDataSource(DataSource.get("myDS"));
treeGrid.fetchData(new Criteria(), new DSCallback() {
@Override
public void execute(DSResponse response, Object rawData, DSRequest request) {
treeGrid.setData(response.getData());
}
}, req);
I am getting data back from a SmartGWT DMI datasource but can't get that data to show up in a tree. Is there some way to specify what should show in the tree once data is returned?
final TreeGrid treeGrid = new TreeGrid();
treeGrid.setWidth(260);
treeGrid.setHeight(555);
treeGrid.setShowRoot(true);
DSRequest req = new DSRequest();
req.setOperationId("fetchData");
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("param1", "value1");
paramMap.put("param2", "value2");
req.setData(paramMap);
treeGrid.setDataSource(DataSource.get("myDS"));
treeGrid.fetchData(new Criteria(), new DSCallback() {
@Override
public void execute(DSResponse response, Object rawData, DSRequest request) {
treeGrid.setData(response.getData());
}
}, req);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不熟悉 DMI,但如果您使用的是 SmartGwt 数据源,它内置了所有代码,只需附加和获取即可。但是,如果您手动添加数据(您的代码片段似乎就是这种情况),请查看此处使用的源代码 -
您需要定义一个 TreeNode 对象等。
希望这会有所帮助!
I am not familiar with DMI, but if you are using a SmartGwt datasource, it has all the code inbuilt, just attach and fetch. But if you are adding data manually (as seems to be the case with ur code snippet), look at the source code used here -
http://www.smartclient.com/smartgwt/showcase/#tree_databinding_local
You need to define a TreeNode object etc.
Hope this helps!