Here's what I do:

@"isExpanded" is a persistent attribute of my model objects.

In the delegate

- (void)outlineViewItemDidExpand:(NSNotification *)notification;
{
[[[[notification userInfo] valueForKey:@"NSObject"] representedObject] setValue:[NSNumber numberWithBool:YES] forKey:@"isExpanded"];
}

- (void)outlineViewItemDidCollapse:(NSNotification *)notification;
{
[[[[notification userInfo] valueForKey:@"NSObject"] representedObject] setValue:[NSNumber numberWithBool:NO] forKey:@"isExpanded"];
}

In an NSOutlineView subclass

- (void)reloadData;
{
        [super reloadData];
        NSUInteger row;
        for (row = 0 ; row < [self numberOfRows] ; row++) {
                NSTreeNode *item = [self itemAtRow:row];
                if ([[item representedObject] isMemberOfClass:[ESGroupNode 
class]])
                        if ([[[item representedObject] 
valueForKey:@"isExpanded"] boolValue])
                                [self expandItem:item];
        }
}


works like a charm

Jon

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to