Consider an application that displays a table (of arbitrary length) where the table is comprised of a header that includes an "expand-all/collapse-all" button, and each row in the table includes a local expand/collapse button. That is, the "expand-all/collapse-all" button is NOT expanding and collapsing the list itself, but rather it is expanding and collapsing the details of each row in the list.
Schematically, here is the list with all rows collapsed. The header row has an expand-all icon (+) and each row has an expand-row icon (+).
+ name condition type + fred 5 B + sally 23 C
If I click on the individual expand-row next to fred, the list would now show this. Note that (a) the expand-row icon on the row has toggled from a plus to a minus, indicating it is now for collapsing, and (b) details about fred appear immediately below the original row.
+ name condition type - fred 5 B Before Data After Data foobar1 foobar2 + sally 23 C
Next, let's say I click the expand-all icon. Note that ALL icons have now switched from plus to minus (regardless of their prior state), indicating they would now collapse when next pressed, and that each row has details immediately below it.
- name condition type - fred 5 B Before Data After Data foobar1 foobar2 - sally 23 C Before Data After Data chocolate vanilla with strawberries
Now to my specific scenario and my question:
- Start with all items collapsed; the header row and all rows have an expand (+) icon.
- Press expand-all; all rows expand; the header row and all rows now have a collapse (-) icon.
- Press the collapse icon on the "fred" row; its row icon changes to expand (+). What, if anything, happens to the icon on the header row?
Keep in mind that this list may have anywhere from dozens to hundreds of rows. Technically, the collapse-all icon appears because all rows are expanded; thus if even one row is collapsed then it is no longer the case that all rows are expanded, so should it still show collapse-all? What about if 5 rows are individually collapsed? Or what if (n - 1) rows are individually collapsed, leaving only a single expanded row?
I want the expand-all/collapse-all icon button/icon to do what the user reasonably expects within the limits of this design. My leaning is that what happens on individual rows should be of no interest to the expand-all/collapse-all button (with one exception). If the user has collapsed 5 rows, then collapse-all should still work, just having no work to do on those 5 rows because they are already collapsed. The one exception is that if and when the user manually collapses the very last row, after having collapsed all the others, then and only then should the collapse-all take notice and switch to expand-all.
So--within the limits of this visual layout--is that a reasonable user experience?