bootstrap-treeview tree menu control

bootstrap-treeview tree menu control

https://github.com/jonmiles/bootstrap-treeview

            var tree = [
            {
                text: "Parent 1",
                id:1,
                nodes: [
                {
                    text: "Child 1",
                    id:2,
                    nodes: [
                    {
                        text: "Grandchild 1",
                        id:3,
                    },
                    {
                        text: "Grandchild 2",
                        id:4
                    }
                    ]
                },
                {
                    text: "Child 2",
                    id:5
                }
                ]
            },
            {
                text: "Parent 2",
                id:6
            },
            {
                text: "Parent 3",
                id:7
            },
            {
                text: "Parent 4",
                id:8
            },
            {
                text: "Parent 5",
                id:9
            }
            ];
            $('#tree').treeview({
                    data: tree, // data source
                    showCheckbox: false, //whether to show the checkbox
                    highlightSelected: true, //whether it is highlighted
                    nodeIcon: 'glyphicon glyphicon-user', //icon on the node
                    //nodeIcon: 'glyphicon glyphicon-globe',
                    emptyIcon: '', //Node icon without child nodes
                    multiSelect: false, //Multiple selection
                    onNodeChecked: function (event,data) {
                        console.log("nodeId = "+data.nodeId);
                        console.log("id = "+data.id);
                    },
                    onNodeSelected: function (event, data) {
                        console.log("nodeId = "+data.nodeId);
                        console.log("id = "+data.id);
                    }
                });

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326452208&siteId=291194637