有没有一种方法可以将jquery可排序的ui集成到呈现为json的jonmiles引导树视图中?

时间:2020-08-21 10:08:03

标签: jquery-ui-sortable bootstrap-treeview

我正在使用jonmiles引导树视图,并且数据通过PHP在json中呈现。我想知道是否可以使用jquery ui以某种方式使它可排序。感谢您的帮助。

PHP:

public function jsonSerialize() {
    return (object) [
        'text' => $this->title,
        'nodes' => $this->children,
        'tags' => ['4']
    ];
}

HTML:

        <div id="categories" class=""></div>

脚本:

<script type="text/javascript">
let categories = @json($categories);
$('#categories').treeview({
    data: categories,
    onhoverColor: '#dee2e6',
    expandIcon: "glyphicon glyphicon-plus",
    collapseIcon: "glyphicon glyphicon-minus",
    emptyIcon: "glyphicon",
    showTags: true,
    showIcon: true,
    silent: true
});

0 个答案:

没有答案