- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在寻找通过 REST 使用 dojo.store
和 dijit.Tree
的端到端示例。
有许多现有示例使用旧的 dojo api,dojo.data.api
,但使用 dojo.store
api 的示例很少。
是dijit.Tree
还没有完全支持dojo.store
的原因吗?如果是这样,我是否需要使用 dojo.data.ObjectStore
包装器来封装 dojo.store
以便与 dijit.tree
一起使用?
我看到了一个通过扩展 StoreFileCache 来解决这个问题的例子: http://dojo-toolkit.33424.n3.nabble.com/New-object-store-and-dijit-Tree-td2680201.html
这是推荐的选项,还是我应该
a) 坚持使用 dojo.data.api
直到 dijit.Tree
直接支持 dojo.store
,或者
b) 使用dojo.data.ObjectStore
包装器
谢谢
最佳答案
现在 DTK 网站上有一个教程似乎涵盖了这个主题。
http://staging.dojotoolkit.org/documentation/tutorials/1.6/store_driven_tree/
但是,据我所知,在不给出答案的情况下链接到某些内容被认为是一种糟糕的做法,一般的想法是,与其使用 dojo.data.ObjectStore
环绕它,然后可能推通过 ForestStoreModel
,您可以简单地扩充基于 dojo.store
的商店,以添加树将查找的方法。这是教程中的一个简单示例:
usGov = new dojo.store.JsonRest({
target:"data/",
mayHaveChildren: function(object){
// see if it has a children property
return "children" in object;
},
getChildren: function(object, onComplete, onError){
// retrieve the full copy of the object
this.get(object.id).then(function(fullObject){
// copy to the original object so it has the children array as well.
object.children = fullObject.children;
// now that full object, we should have an array of children
onComplete(fullObject.children);
}, onError);
},
getRoot: function(onItem, onError){
// get the root object, we will do a get() and callback the result
this.get("root").then(onItem, onError);
},
getLabel: function(object){
// just get the name
return object.name;
}
});
值得注意的是,在这种情况下,我们对数据的外观做了一些假设。您需要了解您的 child 如何关联并为此目的定制以下方法,但希望您自己已经相当清楚如何做到这一点。
您现在也可以只使用 dojo.data
API,但这种方法确实感觉更轻量级。它从堆栈中取出几个层,并且自定义基于 dojo.store
的商店要容易得多。
关于rest - 在 REST 上寻找带有 dijit.Tree 的 dojo.store 示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6654251/
我的 Dojo 应用程序包含几个小部件,它们都在 dijit.registry(dijit.WidgetSet 的一个实例)中自动注册。我想利用 filter() ( Link ) 或 map() (
我使用的是 Dojo 工具包版本 1.3.1。我在 jsp 页面中定义了以下 dijit: Zoom In hi
我正在尝试以编程方式创建这样的布局: 我使用的是 dojo 1.7,布局初始化可能存在问题。 这是我的 attempt . 谢谢你帮助我 最佳答案 让BorderContainer设置 Dialog
我有一个包含模板化表单的dijit.dialog。当对话框可见并且我调整窗口大小时,表单高度会减小(即使我增加/减小窗口大小)。是什么导致了这种奇怪的行为以及如何防止它?谢谢。 代码:@LoginFo
我有一个菜单,其内容需要根据用户交互进行显着更改。这意味着需要引入一些新的菜单项,也需要删除一些菜单项。查看 Dojo 已发布的 API 文档,似乎没有一种方法可以在不删除现有项目并从头开始重新创建菜
我有以下小部件 HTML。 后面带有以下 Javascript: /** * Javascript for ExpandableSearchComponen
我正在尝试以编程方式将 dijit/布局/内容 Pane 添加到 dijit/标题 Pane 。我遇到的问题是我无法让内容 Pane 进入标题 Pane ,它被放置在它下面。我的代码是这样的:知道我做
我想要的是一个表单,在提交时运行验证检查,并突出显示所有无效字段并添加工具提示。 我正在有效地寻找这样的东西: dojo.forEach(dijit.byId('myForm')._invalidWi
我已经能够将带有两个 MenuItem 的简单 dijit.Menu 绑定(bind)到带有 Menu.bindDomNode(Tree.domNode) 的 dijit.Tree 的节点,但我想改进
我正在尝试对 dijit/Dialog 的默认行为进行简单的更改。我希望在单击底层(背景)时关闭对话框。 我在以前的 Dojo 化身中做过一次,但我很难用新的 AMD/requireJs 风格来做。
当您使用 dijit.ComboBox 时,提前输入建议将作为 dijit.Menu 实现。我有一个设计要求建议行的匹配部分是正常的,不匹配的部分是粗体。 dojo 创建的结构是这样的:
当我在客户端为我的一个应用程序进行验证时。我脑子里有这些问题。 问题一:dijit.byId('someId').value 和 dijit.byId('someId').get('value') 有
我正在尝试禁用使用 store 填充的 dijit/Form/FilteringSelect 控件中的选项。 遵循本指南:http://dojotoolkit.org/documentation/tu
如何使 titlePane 的高度动态变化,以便在页面加载后向 Pane 添加内容时 TitlePane 会展开? 最佳答案 看起来富内容编辑器是一个异步加载的 iframe 混淆了初始布局。 正如@
我似乎找不到一种方法来要求过滤选择输入具有一定的长度。我试过这样: new dijit.form.FilteringSelect({ 'name': 'bla', 'store': j
我对 Dojo 比较陌生,正在尝试掌握 dijit 的窍门。在此处查阅 Dojo 的 dijit/form/Button 小部件的文档后: http://dojotoolkit.org/referen
我有一个 Dijit Dialog (jsfiddle) 以编程方式创建。当调用对话框显示时,我会在运行时传递按钮的 id。我正在尝试创建单击事件函数,以在运行时为传递的 id 执行。 但是事件并未执
我有一个场景。在其中一个表单中,3 个一组中有 18 个字段,但一次只能有一组(3 个字段)具有值。任何人都可以告诉我如何以最好的方式做到这一点,是否有类似在 dijit 中创建字段组之类的事情?我可
我正在尝试声明一个 dijit TextBox,但我无法将 focus 事件附加到它。 我试过以声明的方式这样做: alert("hi");
我的对话框定义如下
我是一名优秀的程序员,十分优秀!