[英]dijit Tree + checkbox - unable to select/unselect checkbox
I'm trying to place a checkbox inside dijit.Tree by entering input html code as part of label value. 我试图通过输入输入html代码作为标签值的一部分来在dijit.Tree中放置一个复选框。 And it displays ok but I can't check or uncheck it.
它显示确定,但我无法选中或取消选中它。 As if click events are not bubbling/reaching input element.
好像单击事件没有冒泡/到达输入元素。
Here is how I create my tree object. 这是我创建树对象的方法。
myTree = new dijit.Tree({
model: myModel,
showRoot: false,
getLabel: function(item) {
if (!item.root)
return '<input type="checkbox" name="'+ item.name +'" id="'+ item.name +'" value="1" /> '+ item.name;
}
}, "gridDiv");
How can I fix this ? 我怎样才能解决这个问题 ?
right now 2 choices come to my mind: 现在我想到2个选择:
<div data-dojo-type="dijit.form.CheckBox" ... ></div>
and then after the tree's startup event do a dojo.parser.parse(tree.domNode)
. <div data-dojo-type="dijit.form.CheckBox" ... ></div>
,然后在树启动之后事件执行dojo.parser.parse(tree.domNode)
。 This will parse only your grid's DOM node and will convert any dojo style markup into actual dojo objects. I personally recommend, if you can, the first choice. 如果可以的话,我个人建议第一选择。
Luck, 运气,
I'd go with cbtree if I have check boxes in the tree. 如果树中有复选框,我会选择cbtree。 check here
在这里检查
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.