Re: Best way to implement filtering in large Data Set
Re: Best way to implement filtering in large Data Set
- Subject: Re: Best way to implement filtering in large Data Set
- From: Carmin Politano <email@hidden>
- Date: Sun, 15 Apr 2007 07:34:51 -0400
On Apr 15, 2007, at 7:00 AM, Micha Fuhrmann wrote:
Many thanks Carmin,
I'll dive in as you suggest. Last thing, would it be wise to use
Key-Value coding for the songs objects, would that speed up filtering?
Regards,
Micha
On 15 avr. 07, at 01:37, Carmin Politano wrote:
In work with KVC and binding a lot.
The KVC system works predictably very well against anything EXCEPT
NSDictionary and is very fast.
Note: To use KVC against an instance of NSDictionary, donot use
periods in keys or spaces in parent keys.
To cause KVC to skip the instance variable step: Define a method in
the song object class:
+(BOOL) accessInstancesVariablesDirectly; { return NO; }
Also: Cause the song object class to become a subclass of
NSManagedObject.
Doing this causes NSArrayController and NSTableView to be able to
respond to changes made in the song object without writing that code.
KVC is very solid within the system. Use it without fear.
KVO (Cocoa Bindings) has distinctive limitations.
However, given a simple flat list of data, you should have no problems.
Run yourself through Cocoa Application Tutorial Using Bindings
located in the help files.
You will be shocked at how the system is made to do what you want.
Also: If the data you would like to filter is indeed an iTunes list:
I am certain that iTunes makes heavy use of KVC and KVO.
Pull down the File menu and create a New Smart Playlist... and you
will see just the kind of thing that KVC and bindings are made to do.
Rest assured, if you code it yourself, you can do even more.
But, if you use KVC and binding, then clicking on NSTableColumn's
header can be bound to the sort etc. just like you see in iTunes.
Forget filtering at the NSTableView level.
Use an NSArrayController to handle the actual data array (which
accepts filtering, ordering, etc.) and then bind the NSTableView
to the NSArrayController.
On Apr 14, 2007, at 5:43 AM, Micha Fuhrmann wrote:
Hi there,
I would need help at a higher architecture level, the subject
being how to best implement a table view filtering with a large
data set. The best example existing I can think of is iTunes.
The main table (Unfiltered) would contain all the songs in the
dataset. Behind would be an Array contain "Songs" Object which
would contain all the Songs specifics (Artist, Album etc).
On the side would be 2 other tables contain all the Artist and
all the Genres.
Now what would be the best way to implement both
"objectValueForTableColumn" and "numberOfRowsInTableView" as the
filtering starts.
For the moment all I could come up with is to create a "Sub
Array" derived from the Main Array with loops using the constrains.
There must be a better way to do this then looping around.
Any help would be greatly appreciated.
Micha
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40verizon.net
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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