Magento 2:使用jstree创建treeview时出现问题

时间:2018-10-31 13:06:47

标签: magento magento2 jstree

我正在尝试使用magento 2中的jstree插件创建Treeview,它正在显示树结构,但未显示文本 任何帮助将不胜感激

以下是代码

<div class="row">
<div class="col-md-12 col-xs-12">
    <div class="row">
        <div class="col-xs-2">
            <div id="treeview_div"></div>
        </div>
        <div class="col-xs-10">
            Summary data here
        </div>
    </div>
</div>

 <script type="text/javascript" >
        require(['jquery', 'jquery/ui', 'jquery/validate', 'mage/translate', 'mage/mage', "jstree"], function ($) {

             var jsonTreeData1 = [{
                    "id": "1",
                    "name": "Electronics",
                    "text": "Electronics",
                    "parent_id": "0",
                    "data":{},
                    "a_attr": {
                        "href": "google.com"
                    }

                }];

            $('#treeview_div').jstree({
                plugins: ["themes", "json_data", "ui"],
                'json_data': {
                    'data': jsonTreeData1
                },
                "themes": {
                    "theme": "default",
                    "dots": false
                },
            });

        });

    </script>

0 个答案:

没有答案