介绍现在项目中使用到的dojo tree
来源:互联网 发布:isis仿真软件元器件 编辑:程序博客网 时间:2024/06/15 17:19
在我们项目中也如上篇文章介绍的那样,使用dojo中的dijit.tree,如下代码所示,大家可以看出,动态语言给我们很充足的可编程性。 主要提供:打开节点、拖拽排序等常用功能。
//创建数据源,确定基本根节点以及其children节点var treeItems = [ {id : "root",displayNameCh : _rootLabel,displayNameEn : _rootLabel,children : allItems} ];this.loadTreeByData (treeItems); loadTreeByData : function(/*数据源*/treeItems){var localeName = dojo.locale;var displayName = ""; //国际化设置if (localeName == "zh" || localeName == "zh-cn") {displayName = "displayNameCh";} else {displayName = "displayNameEn";}var data = {identifier : "id",label : displayName,items : treeItems}; //把数据源treeItems包装一下this.workStore = new dojo.data.ItemFileWriteStore({data : data}); //根据TreeStoreModel特性来创建tree所需modelthis.workModel = new dijit.tree.TreeStoreModel({store : this.workStore,childrenAttrs : [ "children" ]}); //存在tree,则销毁if (this.workTree) {this.logger.debug("Destroy old tree");if (this.workTree.destroyRecursive) {this.workTree.destroyRecursive();} else if (this.workTree.destroy) {this.workTree.destroy();}this.workTree = null;} //创建tree单元,这里使用了一些tree相关的高级应用this.workTree = new dijit.Tree({model : this.workModel,openOnClick : false,dndController : "dijit.tree.dndSource",betweenThreshold : 5,onOpen : dojo.hitch(this, this.onRetrieveTag),onClick : dojo.hitch(this, this._onClickItem),onDblClick : dojo.hitch(this, this._onDbClickItem),checkItemAcceptance : dojo.hitch(this, this.onCheckItemAcceptance),persist : false});this.workTree.placeAt(this.containerNode);this.startup(); //用于处理树节点之间的拖拽响应this.connect(this.workTree.dndController, 'onMouseDown', function(e) {// 如果你的树上有滚动条,请加入如下代码,否则如果你选中了节点后拖动滚动条会出现节点拖拽if (dijit.getEnclosingWidget(e.target) == this.workTree) {this.workTree.dndController.mousedown = false;return;}});},
- 介绍现在项目中使用到的dojo tree
- dojo中Tree的使用
- dojo中tree的使用教程(一)
- dojo中tree的使用教程(二)
- 使用dojo的tree
- dojo tree的使用
- 使用dojo的tree
- dojo中button的使用
- struts2 dojo tree使用问题
- 有关dojo中dijit/Tree的操作增、删、修改
- dojo tree控件使用的一些关键点
- dojo-dojo.xhrGet的使用
- 关于DOJO的介绍
- dojo中gridContainer使用时的注意事项
- 3dsmax 如何将其他的模型导入到现在的项目中来
- 项目中使用Tree/LazyTreeGrid
- 项目中使用到的设计模式
- 项目中使用到的技术
- HDU 4300 Clairewd’s message(拓展KMP)
- udev
- Java中的native关键字浅析
- hadoop运行随记
- c++接口
- 介绍现在项目中使用到的dojo tree
- JAVA设计模式---策略模式-2011-05-13
- 日期格式演示
- 计算评分等级(体验三元法)
- objective-c中的@class的作用!
- JAVA设计模式---单一职责模式2011-05-13
- Linux中Kill进程的N种方法
- 安卓铃声目录设置
- JAVA设计模式---封闭原则2011-05-13