Как редактировать вводимый текст Jstree?

avatar
xra
1 июля 2021 в 18:33
156
0
0

я могу использовать тему Metronic, и у меня есть такой класс

       <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.

Пример дерева Metronic

Как я могу получить доступ к вводу? Дерево 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 и я внутри этого значка div, он не отображается. Я вижу только значок папки с файлами. На самом деле мне не нужно динамически.

Источник

Ответы (0)