-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TreeSelect when tree select child is pre selected the parent doesn't mark as partial selected #14499
Comments
Hello @mehmetcetin01140 , |
I found a temporary solution (unsure of the consequences) but it worked for me.. this.nodes = [ ...this.nodes.map(u => ({ ...u, partialSelected: !!selected?.find(x => x.parent?.key == u.key) })) ] Override the resetPartialSelected method with something prevents it from executing. Original (in primeng-treeselect.mjs): resetPartialSelected(nodes = this.options){
if (!nodes) {
return;
}
for (let node of nodes) {
node.partialSelected = false;
if (node.children && node.children?.length > 0) {
this.resetPartialSelected(node.children);
}
}
} Fix (applied in main.ts): TreeSelect.prototype.resetPartialSelected = function(nodes = null){
//
} |
@avim101 will you please update this bug with a title that reflects the issue? This is an issue for my team. Please fix. |
Any news on this bug please? |
@pyrobirb, For me it was only necessary to set the partialSelected myself in ngModelChanges. It worked without touching TreeSelect.prototype in template <p-treeSelect
(ngModelChange)="treeselectChange($event)"
[options]="nodes"
selectionMode="checkbox">
. . . . in component.ts treeselectChange(event: TreeNode[]) {
event.forEach(x => {if (x.parent && !event.includes(x.parent) ) {x.parent.partialSelected = true}})
} |
Due to PrimeNG team's busy roadmap, this issue is available for anyone to work on. Make sure to reference this issue in your pull request. ✨ Thank you for your contribution! ✨ |
Describe the bug
when tree select child is pre selected the parent doesnt mark as partial selected
Environment
primeng latest demo
Reproducer
https://stackblitz.com/edit/n5rewa?file=src%2Fapp%2Fdemo%2Ftree-select-reactive-forms-demo.ts
Angular version
17.0.5
PrimeNG version
17.3.1
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
18.18.0
Browser(s)
all
Steps to reproduce the behavior
Expected behavior
parent of the selected node should shown as partial selected [-]
The text was updated successfully, but these errors were encountered: