Hello! Thank you for a great module!! This is almost exactly what I'm looking for... close enough to use for now, but the behavior I'm looking for is called PROPAGATE_PRESERVING_CHECK in this demo: http://www.essi-lab.eu/projectsSites/lablib-checkboxtree/
That is, when selecting or unselecting a parent, all children become selected or unselected to match. If one of the children is unselected, the parent gets unselected. Selecting all the children selects the parent.
Unfortunately I'm not proficient enough in Java and jQuery to translate this code from Java to jQuery. Any pointers in the right direction would be appreciated! Thanks again!!
Comment | File | Size | Author |
---|---|---|---|
#17 | unselect-children-1189530-17.patch | 4.35 KB | Jelle_S |
|
Comments
Comment #1
BartK CreditAttribution: BartK commentedI'll see what I can do. I'd like to get 1.0 out the door first before I start in on more features.
Bart
Comment #2
drifter CreditAttribution: drifter commentedHere's a patch against version 1.6 (wasn't sure if 2.x is stable right now) that will give you the option of selecting and unselecting children.
Comment #3
tnightingale CreditAttribution: tnightingale commentedThis extends #2, automatically unchecking of parents if a child item is unchecked.
Comment #4
BenStallings CreditAttribution: BenStallings commentedThank you both! Unfortunately the project I was going to use this for got postponed until spring, so I won't be in a position to test it for a few months. If someone else gets a chance to review the patch before me, that would be great. Thanks in advance.
Comment #5
dams_26 CreditAttribution: dams_26 commentedYes ! need a new release please :)
Comment #6
scotty CreditAttribution: scotty commented#3 works, thank you!
Took me a while to apply. Instructions to use
git apply
from Making a Drupal patch with Git didn't work. Had to resort topatch -p1 <term_reference_tree-select_children-1189530-3.patch
to apply. Probably something I don't understand.The current patch doesn't support the Track list option, however. It doesn't correctly update the list of selected items displayed under the tree.
Comment #7
svdhout CreditAttribution: svdhout commentedPatch #3 works for me as well
Comment #8
Ghostthinker CreditAttribution: Ghostthinker commented#2 works perfect. Thank you, but could you make a patch against the dev version so it can go into the next version?
#3 @ tnightingale
I extended your version of unchecking the parent with this:
I added && !item.hasClass('select-parents') because when both select parents and children is active, it's better to leave the parent checked.
What do you think?
Comment #9
BartK CreditAttribution: BartK commentedIf I get a working patch on the 7.x-1.x git branch, I'll put it in.
Comment #10
BartK CreditAttribution: BartK commentedComment #11
BartK CreditAttribution: BartK commentedPeople following this may want to check out the Cascading Selection option in the new version. It doesn't work *exactly* as described here, but it may be close enough for some people.
Comment #12
BenStallings CreditAttribution: BenStallings commentedThank you, BartK, yes, that's close enough for me.
Comment #13
sbandyopadhyay CreditAttribution: sbandyopadhyay commentedThanks for the great module, BartK. Cascading Selection comes very close to implementing what was described in this post, but there's one thing missing: automatic unselecting of all children, regardless of whether or not they are checked. I've attached a patch that implements this exact functionality. When selected alongside Cascading Selection, this new feature works precisely as described above in the original post.
Comment #14
sbandyopadhyay CreditAttribution: sbandyopadhyay commentedWith the patch attached this time...
Comment #15
sbandyopadhyay CreditAttribution: sbandyopadhyay commentedSo I reviewed the original post again after posting my patch, and I realized that the two are not actually asking for and accomplishing the same thing. I apologize for not reading it more closely before I posted. I guess I've unintentionally hacked this thread for a different purpose. If anyone minds, please feel free to change it back to what it was before -- I'll open up a new issue and re-post my patch there.
The original post requests a system that has the parent's checked status reflect whether or not all the children are checked.
The Cascading Selection system has the children reflect the parent's checked status, but only if all the children were already set uniformly.
The patch in #14 creates a system which will "Force selection of parents". When enabled on its own, this system unchecks all children when a parent is unchecked. When enabled alongside Cascading Selection and Select Parents Automatically, this system forces parents to follow their children, but allows children to not have to follow their parents.
Comment #16
BenStallings CreditAttribution: BenStallings commentedAs the original poster, I have no objection to you hijacking the thread, since my needs have been met already. Thanks for asking.
Comment #17
Jelle_SRerolled patch.
Comment #19
BartK CreditAttribution: BartK commentedI don't have time to test this myself, but if I can get some assurance from the community that this patch works without breaking anything, I'll merge it in and release a new version.
Comment #20
potassiumchloride CreditAttribution: potassiumchloride commentedI am using Cascading Selection and am running into both of the needs described in this post, so I would be happy to test patches if I know which one(s) to test.
My use case:
1. Checking a parent checks all child terms. (works)
2. Checking all child terms checks the parent term. (does not work)
3. When all children are unchecked, the parent is unchecked. (does not work)
4. When a child term is unchecked, the parent is also unchecked (does not work)
5. The parent term does not appear checked unless ALL of the children are checked. (does not work)
Right now, I can check the parent term and all child terms are checked (1). Checking all child terms does not check the parent (2). Unchecking all child terms does not uncheck the parent (3). Checking a parent, then unchecking one of the child terms leaves the parent checked, and I want it to uncheck (4).
Ideally for our case, there would not be a situation where the parent term is checked unless all of the children are checked. I think this is what the poster in #15 described, a system that forces parents to follow their children, but allows children to not have to follow their parents. That post refers to a patch in #14.
@BartK Which patch did you want users to test? #17 has no comments so I'm not sure what issue it is expected to solve. Is it a reroll or update of #14? Or of #3? I'm happy to install and test as best I can, if you can tell me the best place to start.
Comment #21
potassiumchloride CreditAttribution: potassiumchloride commentedComment #22
alex_optimThis behavior is only observed when all the child elements are selected. And that's right. When one of the children is not selected, this rule does not apply. Therefore, I see no reason to change the logic of work. Because everything is working right now.
Comment #23
alex_optim