Re: NSOutlineView -> Reloading ALL data
Re: NSOutlineView -> Reloading ALL data
- Subject: Re: NSOutlineView -> Reloading ALL data
- From: Justin Lundy <email@hidden>
- Date: Sat, 4 Jan 2003 11:27:34 -0800
What I found was that I had to add a method to FileSystemItem to set
the path that an item was pointing to, then pass the rootItem and the
new path to that method, then reload the rootItem. This seems to work
fine. I too have hoped for something simpler, but have been unable to
come up with anything.
- Justin
On Friday, January 3, 2003, at 11:38 PM, Clark Mueller wrote:
Hi,
I've based the code for this one what Apple's OutlineView example does.
From what I understand, it determines its root item in this manner:
- (id)outlineView:(NSOutlineView *)outlineView child:(int)index
ofItem:(id)item {
return (item == nil) ? [FileSystemItem rootItem] : [item
childAtIndex:index];
}
The change that I have made is one that changes the path that is the
root. Therefore, what I have done is tweaked the code in FileSystemItem
such that it takes a path to pass in creating the FileSystemItem, like
so:
- (id)outlineView:(NSOutlineView *)outlineView child:(int)index
ofItem:(id)item {
return (item == nil) ? [FileSystemItem rootItemForPath:path] :
[item childAtIndex:index];
}
That method in itself works just fine; I can pass it a path initially
and it creates the outline view based on that path, but if I change the
value of "path" (which is an instance variable, an NSString), and then
call for the table to reload data, it does not appear to pick up the
new path. That is where I've been stuck.
Something I should ask now is, do I need to implement the methods for
the table view's data source? As far as I can tell, if I implement
them, they never actually get called, so my conclusion was that they do
not need to be there. Am I wrong?
Thanks,
Clark Mueller
email@hidden
On Friday, January 3, 2003, at 09:15 AM, Roarke Lynch wrote:
I'm going to bet that the problem is in your datasource, not in the
outlineView. How is your datasource determining the root item for the
NSOutlineView?
On Friday, January 3, 2003, at 04:55 AM, Clark Mueller wrote:
Hello everyone,
I'm having some trouble forcing my table view to reload (replace,
would be a more accurate term) its root item. The code I have been
using is:
[outlineView reloadItem:[outlineView itemAtRow:0]]
and
[outlineView reloadData] (a la NSTableView).
None of these does anything as far as changing the root item to my
new one (although it does indeed reload that item), so my best guess
is that NSOutlineView is saving its items and reloading them as
required, but not actually replacing them. The root item seems to be
special, as well, in that it's the only one that does this. If new
items are added under the root item, they are added by my call to
reloadData, but again, the root item does not change. Is there a way
to force the view to either reload this item, or to remove it and
then add back the new one?
TIA,
Clark Mueller
email@hidden
Roarke Lynch
-------------------------------
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.