|
|
1
3
我想你是按照 dijit.Tree and dojo.data in Dojo 1.1 指导您使用数据存储将数据传递到树控件的教程。那让我在砖墙上敲了一会儿头。 这并不是一个很好的方法,替代方法也没有很好的记录。您需要创建一个使用模型。我在下面提供了一个树模型的示例,它是我为显示LDAP目录的结构而创建的。 您将在dojo发行版中的/dijit/_tree/model.js中找到该模型的默认实现。这些注释应该帮助您理解模型支持的功能。 下面的IdTrimyService类是用于生成的服务器端Java POJOS的存根 Direct Web Remoting (DWR)。如果要进行大量的客户机-服务器交互,我强烈推荐DWR。 dojo.declare("LDAPDirectoryTreeModel", [ dijit.tree.model ], {
getRoot : function(onItem) {
IDirectoryService.getRoots( function(roots) {
onItem(roots[0])
});
},
mayHaveChildren : function(item) {
return true;
},
getChildren : function(parentItem, onComplete) {
IDirectoryService.getChildrenImpl(parentItem, onComplete);
},
getIdentity : function(item) {
return item.dn;
},
getLabel : function(item) {
return item.rdn;
}
});
这里是我的JSP页面的一个摘录,我在这里创建了模型并使用它来填充树控件。 <div
dojoType="LDAPDirectoryTreeModel"
jsid="treeModel"
id="treeModel">
</div>
<div
jsid="tree"
id="tree"
dojoType="dijit.Tree" model="treeModel"
labelAttr="name"
label="${directory.host}:${directory.port}">
</div>
|
|
|
code-geek · Jquery根据单选按钮选择隐藏或显示文本字段 1 年前 |
|
|
Alex · 在轻量级中同时解构和不解构变量 1 年前 |
|
|
Ângelo Rigo · ReactJS映射:如何迭代[关闭] 1 年前 |
|
|
bairog · 从按属性筛选的对象数组字典中创建值数组 1 年前 |
|
|
lokiuucx · JS对象属性返回未定义,尽管对象属性应该有值 1 年前 |