Using Bootstrap v3.3.7 with ng2-dropdown-tree and how to get ParentID
Closed this issue · 2 comments
NitinTiwari1010 commented
Hi, This is excellent tree view control in Angular 2. Need your help to fix two issue which I am facing
- I tried using bootstrap version 3.3.7 with treeview because we don’t want to use bootstrap alpha version.
I have created dropdown in bootstrap 3.3.7 version and add tree control inside that. Everything is working perfectly fine except when I try to click on parent expend/collapse icon,it close my dropdown as well. I tried to use $event.stopPropagation() event as well but no luck. Below is the code:
Included Accounts
- How to get the Parent ID when parent is selected, currently it only gives me all the child nodes (leaf node only), as per our requirement we need to display parent if parent is selected. we are using three layer hierarchy like national, regional and local so if all the local are selected, show only regional and if all the regional selected show only National.
</ul>
</div>
Thanks in Advance..
leovo2708 commented
-
There are many differences between Bootstrap 3.3.7 and Bootstrap 4 also as between Bootstrap 4 alpha 5 and Bootstrap 4 alpha 6. Writing a component is only below specified CSS framework which I am using is Bootstrap 4 alpha 6. A solution is that you should custom my component with Bootstrap 3.3.7.
-
Sorry, you can't get parent of current item. However, I wrote TreeviewHelper to help you to get parent item. Another solution is that you save parent in value of TreeviewItem. Example:
const parentItem: TreviewItem; // set parent data here
const treeviewItem = new TreeviewItem({
text: 'XXX',
value: {
parent: parentItem,
data: {}
}
});
leovo2708 commented
Try to use my new component for Angular 4:
https://www.npmjs.com/package/ngx-treeview