javascript - 如何编辑 Jstree 输入文本?
问题描述
我可以使用 Metronic Theme 并且我有这样的课程
<div class="pb-5" data-wizard-type="step-content">
<div id="kt_tree_2" class="tree-demo">
<ul>
<li>
Root node 1
<ul>
<li data-jstree='{ "icon" : "flaticon2-analytics text-success " }'>
</li>
</ul>
</li>
<li data-jstree='{ "type" : "file" }'>
</li>
</ul>
</div>
</div>
当我在我的主题中写文字时不会显示它。我更改了根节点 1 文本。
我怎样才能访问输入?JS树
this._data.core.original_container_html = this.element.find(" > ul > li").clone(true);
this._data.core.original_container_html
.find("li").addBack()
.contents().filter(function() {
return this.nodeType === 3 && (!this.nodeValue || /^\s+$/.test(this.nodeValue));
})
.remove();
this.element.html("<"+"ul class='jstree-container-ul jstree-children' role='group'><"+"li id='j"+this._id+"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='none'><i class='jstree-icon jstree-ocl'></i><"+"a class='jstree-anchor' role='treeitem' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>" + this.get_string("Loading ...") + "</a></li></ul>");
this.element.attr('aria-activedescendant','j' + this._id + '_loading');
this._data.core.li_height = this.get_container_ul().children("li").first().outerHeight() || 24;
this._data.core.node = this._create_prototype_node();
_create_prototype_node : function () {
var _node = document.createElement('LI'), _temp1, _temp2;
_node.setAttribute('role', 'none');
_temp1 = document.createElement('I');
_temp1.className = 'jstree-icon jstree-ocl';
_temp1.setAttribute('role', 'presentation');
_node.appendChild(_temp1);
_temp1 = document.createElement('A');
_temp1.className = 'jstree-anchor';
_temp1.setAttribute('href','#');
_temp1.setAttribute('tabindex','-1');
_temp1.setAttribute('role', 'treeitem');
_temp2 = document.createElement('I');
_temp2.className = 'jstree-icon jstree-themeicon';
_temp2.setAttribute('role', 'presentation');
_temp1.appendChild(_temp2);
_node.appendChild(_temp1);
_temp1 = _temp2 = null;
return _node;
},
我尝试手动 li 和 i 标签。如果我创建 li 并且 i 在此 div 图标内不显示。我只看到文件夹图标。其实我不需要动态。
解决方案
推荐阅读
- c++ - 当vector的大小太大时,如何解决C++中内存不足的问题?
- google-cloud-platform - Cloud Run 和 Cloud Scheduler - 在完整数据集上获取失败结果
- c - 在 kthread_run 中通过花括号和多个分号进行宏扭曲
- python - 在 python 中求解代数方程
- python - Mac 上 Python 和 ffmpeg 的权限问题
- c++ - 试图在自己的 .cpp 和 .h 文件中制作 Node
- c++ - Add a variable to a struct at runtime C++
- python - 函数可以返回 Python 中使用的另一个函数
- linux - X (Linux) 上的镜像窗口
- python - 在python中拆分字符串