dojoTree TreeSelector

dojoTree TreeSelector

TreeSelector继承于HtmlWidget,其作用主要是处理Tree的Select的功能。
1:具有selectedNode的属性
2:默认的事件名有:
eventNamesDefault: {
  select : "select",
  destroy : "destroy",
  deselect : "deselect",
  dblselect: "dblselect" // select already selected node.. Edit or whatever
 },
3:注意这段代码:eventNames的值。
initialize: function() {

  for(name in this.eventNamesDefault) {
   if (dojo.lang.isUndefined(this.eventNames[name])) {
    this.eventNames[name] = this.widgetId+"/"+this.eventNamesDefault[name];
   }
  }

 },
4:监听树的事件:
listenTree: function(tree) {
  //标题和图标的click都绑定到Selector的select事件。
  dojo.event.topic.subscribe(tree.eventNames.titleClick, this, "select");
  dojo.event.topic.subscribe(tree.eventNames.iconClick, this, "select");

  dojo.event.topic.subscribe(tree.eventNames.collapse, this, "onCollapse");
  dojo.event.topic.subscribe(tree.eventNames.moveFrom, this, "onMoveFrom");
  dojo.event.topic.subscribe(tree.eventNames.removeNode, this, "onRemoveNode");
  dojo.event.topic.subscribe(tree.eventNames.treeDestroy, this, "onTreeDestroy");

  /* remember all my trees to deselect when element is movedFrom them */
  this.listenedTrees.push(tree);
 },

5:



你可能感兴趣的:(dojoTree TreeSelector)