How can bootstrap-treeview uncheck the status when clicking on the same node?

how can bootstrap-treeview uncheck the state when clicking on the same node? The
action is to click on the node, and the clicked node is selected (no checkbox), clicks on the node again, and the node selection is canceled. It is true that the official website document is designed in this way. I don"t know how to modify it so that multiple clicks on the same node will not affect the selected status.

Mar.04,2021

preventUnselect:true,

whether preventUnselect Boolean false can be selected when another node is not selected,
is set to true. Default is false

document: https://my.oschina.net/u/3242.


Hello, I have the same problem as you. Have you solved it? Please let


I also encountered the same problem, I am adding two events that will deselect the node to select again.
$(".tree"). Treeview ({

)
        data: FNodes, backColor: 'transparent', showBorder: false, color: "-sharpffffff", selectable: false, showCheckbox: false,
        onNodeSelected: function (event, data) {
            var sels = $('.tree').treeview('getSelected');
            for (var i = 0; i < sels.length; iPP) {
                if (sels[i].nodeId == data.nodeId) {
                    continue;
                }
                $('.tree').treeview('unselectNode', [sels[i].nodeId, { silent: true }]);
            }
            $(".tree").treeview('selectNode', [data.nodeId, { silent: true }]);
        },
        onNodeUnselected: function (event, data) {
            var sels = $('.tree').treeview('getSelected');
            for (var i = 0; i < sels.length; iPP) {
                if (sels[i].nodeId == data.nodeId) {
                    $(".tree").treeview('selectNode', [data.nodeId, { silent: true }]);
                    continue;
                }
                $('.tree').treeview('unselectNode', [sels[i].nodeId, { silent: true }]);
            }
        }
    });
Menu