Href does nothing
vinimk opened this issue · 9 comments
Describe the bug
The href property when set just sets an href to the div, but it does nothing if you click on it
To Reproduce
Steps to reproduce the behavior:
Use below for tree nodes:
var json = [
{
text: "Main",
icon: "fa fa-inbox",
nodes: [
{
text: "Google",
href: "www.google.com"
}
]
}
];
Then open the tree an click on "Google", see it has an 'href' but nothing happens
Expected behavior
When clicked, the google should open (or in a new tab if clicked with the middle mouse button)
Screenshots
Desktop (please complete the following information):
- OS: Windows 10
- Browser Firefox
- Version 74.0
@vinimk
I personally don't consider this a bug.
A default behaviour for menu items other than expanding/collapsing menus is simply not implemented yet. This repo is fairly new and not finished yet as far as I see it.
Maybe you want to consider to make a feature request ...
it might be, I just considered a bug because in the read-me say that is implemented
Not all menu items are supposed to act as link to another resource/website or whatever. Some of them just open a submenu. And this is done by making use of Bootstrap Collapse which relies on the href attribute in order to link a clicked menu item with the submenu to open.
@chniter @vinimk
In my fork of bstreeview I changed the script to use the data-target
attr instead of the href
attr to collapse/expand a submenu. So a list-group-item
only has an href
attr value when configured.
This would make it easier to implement a default handler navigating to the value set in the href.
Good day @Flyer53 not sure if i understand correctly, but also thought href would be a link to a page or external link.
I did upload your fork to my test site, but still not working with href.
Please guide me to use bstreeview as a link menu.
Thank You
Albertus Geyser
@albertusgeyser
Which fork did you download? The original one from @chniter or the one from @Flyer53 ?
But whatever fork you used, do you realize that the elements getting the href
attribute value are <div>
elements, not <a>
elements? You have to implement some logic that actually navigates to the url. Clicking a <div>
won't do that automatically, even if it has an href
attribute.
Hello,
I published new version. See the release v1.2.0 https://github.com/chniter/bstreeview/releases/tag/v1.2.0
Please open new issue if you have always the problem.