2

I have a large list of items like this:

Parent 1  
– Child 1.1  
– Child 1.2  
– Child 1.3  
...  

Parent 2  
– Child 2.1  
– Child 2.2  
...  

where every element has a checkbox.

I want to be able to select only the parent (without the children) as well as have the children be selectable on their own or all together when clicking the parent.

As for this moment, you have to select each item individually (when you click on the parent, you only select the parent), but I don't think it solves the problem. Is there any pattern for this? Any ideas?

6
  • 3
    In interfaces like this that I have encountered, selecting the parent implies selecting all children (a partial selection state for the parent may be introduced if some children are selected). What you propose is confusing, because it's not clear what it means to select the parent. Could you elaborate more on what this interface is doing?
    – user31143
    Jun 16, 2016 at 12:43
  • 3
    This is confusing. Why would you allow Parent to be selected if you don't mean to select all the children? Jun 16, 2016 at 13:02
  • I agree with you both: it's confusing and there are not any examples of situations like this, probably because it doesn't make sense! But imagine, for example, you need to select the parent only to add another child (this may be a dumb example, but it’s the only one I can think of right now). Or imagine the parent is a Process, while children are documents of that Process, and you want to act or edit the project, but not it’s documents. Did I make it clear?
    – Ana Soares
    Jun 16, 2016 at 14:04
  • @AnaSoares you seem to be struggling to come up with hypothetical examples...is there an actual need for this functionality in what you are building?
    – user31143
    Jun 16, 2016 at 14:16
  • I’m replacing the designer that started the project… so unfortunately I’m a little caught in the middle! I was asked to solve some problems that were left unsolved. In this case, the client asked specifically for a solution for this type of problem, but didn’t provide specific examples. Just that, at this point, the selection is one by one, without taking in consideration dependencies or hierarchies (selecting the parent doesn’t select its children). But that it is important to select children or parent alone so… fix it designer :)
    – Ana Soares
    Jun 16, 2016 at 14:30

1 Answer 1

1

The 2nd paragraph ["I want to be able to select only the parent (without the children) as well as have the children be selectable on their own or all together when clicking the parent"] makes it sound like you want to enable selection of the children checkboxes when the parent is checked, and disable selection of the children checkboxes when the parent is un-checked. That's the pattern you are looking for. Are you looking guidance on how to implement that?

I think part of the confusion is the use of "parent" and "child." This can imply a class-based hierarchy, where the children are specific types of the parent. That seems to be the type of relationship most of the comments are thinking of. (See taxonomy in wikipedia: https://en.wikipedia.org/wiki/Taxonomy)

But parent-child can also imply a containment-based hierarchy, where the children are merely contained (physically or logically) within a parent. HTML is a good example. A img (image) tag can be a child of a p (paragraph) tag...

<p>
<img src="images/animals/cat.jpg" />
</p>

...without the img tag being a type of the p tag. (See wikipedia meronomy: https://en.wikipedia.org/wiki/Meronomy)

It seems like a meronomy might be the type of parent-child relationship you're referring to.

Could you clarify?

I'm only guessing here, but I suspect a scenario that might be similar to your needs is something like this:

[] Yes! Send me your product for only $9.99!
     [] Include gift wrapping for only $2.50 more
     [] Send by overnight delivery for only $19.25 more
     [] Include postal insurance for an additional $12.50

In this case, it would only make logical sense to select the "children" if the parent was selected, but selecting the parent without the "children" is also a logical possibility.

If that's the case, then I'm not sure what you're asking. You need to enable or disable (or possibly hide) the children based on the selection state of the parent. Are you looking for guidance on how to implement such a solution? That would depend on the medium and language you are using (Andoid, JavaScript, Visual Basic, Java, etc.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.