Comments (11)
please get some example to get parent value(Id) in items. I think, It's very important for all developers.
Parent (value: 1) -- I need this value, but I think this component doesn't have such functionality.
--Child 1 (value: 2)
--Child 2 (value: 3)
from ngx-treeview.
Question 1: using TreeviewEventParser like in my example 5 https://leovo2708.github.io/ngx-treeview/. You can get list of checked from root to leaf.
Question 2: Yes, you can. You can update checked of your TreeviewItem object. But it will not update checked of parent, you must do this yourself. You should write a helper to handle this.
from ngx-treeview.
Thanks for quick resposne @leovo2708.
Yes, #1, I was thinking about create a custom TreeviewEventParser to return a flat list of selected items.
About #2, can you give an example?
What I was thinking is in TreeviewItemComponent
onCheckedChange = (skipChildrenCheck) => {
const checked = this.item.checked;
if (!_.isNil(this.item.children)&& !skipChildrenCheck) {
this.item.children.forEach(child => child.setCheckedRecursive(checked));
}
this.checkedChange.emit(checked);
}
onChildCheckedChange(child: TreeviewItem, checked: boolean, skipParentUpdate) {
if (this.item.checked !== checked && !skipParentUpdate) {
let itemChecked = true;
for (const tmpChild of this.item.children) {
if (!tmpChild.checked) {
itemChecked = false;
break;
}
}
this.item.checked = itemChecked;
}
this.checkedChange.emit(checked);
}
I tried to override the onCheckedChange
and onChildCheckedChange
but the component is not exported from the lib so not so sure how I can achieve this.
from ngx-treeview.
If I support option {disabled: true, checked: false} for item ReactJS, does it rescue you?
from ngx-treeview.
from ngx-treeview.
I think you can use itemTemplate. It can help you.
from ngx-treeview.
@leovo2708 I need a way to emit this event this.checkedChange.emit(checked)
; using itemTemplate without calling onCheckedChange
and onChildCheckedChange
.
I think this requires a minor change in TreeviewItemComponent
and TreeviewItemTemplateContext
.
from ngx-treeview.
Please help me to create pull request. Thanks.
from ngx-treeview.
Published in new version 1.2.2.
from ngx-treeview.
Hi,
"selectedChange" event has been fired when selecting Parent but the $event array is empty. But the expected would be event array with Parent node value.
I guess the problem is with binding the selected node in ngmodel
Its working as expected when I select child nodes. I'm using the latest verion 1.2.3.
Parent and child nodes can be selected independently by setting decoupleParentChild= true in the config.
from ngx-treeview.
same issue please let me know if it's fixed
from ngx-treeview.
Related Issues (20)
- issue with bootstrap 5 HOT 1
- Performance issue when there are lots of data in ngx-treeView HOT 1
- I need ngx-treeview without checkbox. (NOT ngx-dropdown-treeview)
- Does not update the "options selected" message HOT 1
- Template to expand / collapse on name click
- Highlight the searching text
- Without Bootstrap
- How hide checkbox in treeview, only last child (of each node) ?
- Clear filter is not there
- How to decople parent checkboxes Except children checkboxes
- Compatibility issue with Angular 9.1.13
- Compatibility issue for Angular 14 HOT 1
- load items from data, DownlineTreeviewItem selection by order not work
- Add onDropdownClose event for ngx-dropdown-treeview
- I don't find any compatible version of ngx-treeview 10.0.2 for Angular 15 HOT 1
- Compatibility issue for Angular 13
- Compatibility issue with Angular 16 HOT 1
- Unable to choose a vale while the filter is active
- error NG6002: 'TreeviewModule' does not appear to be an NgModule class. HOT 2
- Enable child node when parent is disabled.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-treeview.