Re: Editing NSOutlineView Group Item
Re: Editing NSOutlineView Group Item
- Subject: Re: Editing NSOutlineView Group Item
- From: Ken Thomases <email@hidden>
- Date: Sun, 02 Nov 2014 16:18:10 -0600
On Nov 2, 2014, at 3:44 PM, Graham Cox <email@hidden> wrote:
> On 1 Nov 2014, at 8:38 pm, Luther Baker <email@hidden> wrote:
>
>> How do I get an NSOutlineView row, designated as a "group" row, to reload
>> itself?
>
> You might be mistaking a group row for a "parent" row (these don't have a special name, but they're the ones that have turndown triangles that can open to show some contained content). A group row is really just a section heading, though these have a show/hide button that can disclose their content. For example, if you look in the source list in Mail, there's a group row at the top called 'MAILBOXES', whereas each mailbox has an icon and a turn-down triangle.
>
> So, knowing what a group row *is*, it should be obvious that there's no content to reload - it's just a text label to mark off one section from another. If you want to reload a parent row, that's just done using the -reloadItem:reloadChildren: method as usual. To reload a group means reloading the item that contains it, most likely the root.
This is not correct. Group items are items for which the delegate returns YES from -outlineView:isGroupItem:. They can have children or not. If a group item shows a Show/Hide button, what gets shown or hidden are its children. The button just expands or collapses the row.
They definitely have content which is subject to reloading, just like any other row. It's not just a text label. It's a full-fledged item, just with a different style. One can use -reloadItem:… with items with or without children; it's not restricted to "parent rows".
As to the original question:
On Nov 1, 2014, at 4:38 AM, Luther Baker <email@hidden> wrote:
> - and for the most part, telling the outline view to reload data for the
> selected row is working out ... unless the row is designated as a GROUP row.
>
> The group row just doesn't seem to respond to a reload directive ... even
> if I include all the columns (of which it really has none).
>
> How do I get an NSOutlineView row, designated as a "group" row, to reload
> itself?
All of the mentions of reloading a _row_ in the above show the misunderstanding. For outline views, one should generally use the _item_ methods where available. So, you should use -reloadItem:, not -reloadDataForRowIndexes:columnIndexes:. Among other things, that avoids the question of what column index(es) to supply, when group rows aren't associated with any column.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden