Reputation: 4947
I'm working on a .net core application where I'm using the Bootstrap Treeview. Here is part of the javascript that sets up my tree:
var tree = [
{
text: "Assets",
href: "http://localhost:63690/asset/index",
nodes: [
{
text: "Barcode"
},
{
text: "Importation"
}
]
},
{
text: "Inventory",
nodes: [
{
and here is my markup in my view:
<div id="tree" class="treeview"></div>
Based on the information on this page I should just be able to put the URL in the href property. But when I run the app, no link or anchor gets rendered and nothing happens when I click on my Assets node. What am I missing?
I also added the following to geenrate the treeview:
$('#tree').treeview({
data: tree,
levels: 5,
backColor: 'white',
expandIcon: "glyphicon glyphicon-triangle-right",
collapseIcon: "glyphicon glyphicon-triangle-bottom",
showBorder: false
});
Upvotes: 0
Views: 2297
Reputation: 151
I just get the same problem, and I find the solution in project's document.
enableLinks
Boolean. Default: false
Whether or not to present node text as a hyperlink. The href value of which must be provided in the data structure on a per node basis.
So you should add enableLinks: true
to your code like this:
$('#tree').treeview({
data: tree,
levels: 5,
backColor: 'white',
expandIcon: "glyphicon glyphicon-triangle-right",
collapseIcon: "glyphicon glyphicon-triangle-bottom",
showBorder: false,
enableLinks: true
});
Upvotes: 2