chniter / bstreeview

Bootstrap Treeview, A very simple plugin to build a basic and elegant Treeview with bootstrap 4. See the demo:
https://chniter.github.io/bstreeview/
Apache License 2.0
367 stars 53 forks source link

Href does nothing #10

Closed vinimk closed 4 years ago

vinimk commented 4 years ago

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):

Flyer53 commented 4 years ago

@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 ...

vinimk commented 4 years ago

it might be, I just considered a bug because in the read-me say that is implemented

Flyer53 commented 4 years ago

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.

Flyer53 commented 4 years ago

@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.

Flyer53 commented 4 years ago

@chniter @vinimk I further updated my fork to automatically navigate to the href attr value of the clicked item.

albertusgeyser commented 4 years ago

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

Flyer53 commented 4 years ago

@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.

chniter commented 4 years ago

Hello,

I published new version. See the release v1.2.0 https://github.com/chniter/bstreeview/releases/tag/v1.2.0

chniter commented 4 years ago

Please open new issue if you have always the problem.