• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to set a default filter on an NSTableView so that no data is displayed if NSSearchField is empty?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to set a default filter on an NSTableView so that no data is displayed if NSSearchField is empty?


  • Subject: How to set a default filter on an NSTableView so that no data is displayed if NSSearchField is empty?
  • From: Peter <email@hidden>
  • Date: Sun, 08 Jul 2012 01:18:22 +0200

Hi,

is there an elegant/easy way to achieve this?

The scenario:
Target 10.5 on OS 10.6 (10.5 may be given up in the future).
Cell based table view bound to core data.
Controller set to prepares content, so all the data is loaded.
On entering a string into an NSSearchField the data is filtered.
This is pretty default and works.

What I want to see:
The table view comes up empty.
On entering a string, the table view displays the filtered data.
I clear the string and the table view goes blank again.

How could I achieve this?

I guess I could check for an empty string in controlTextDidChange: and set a predicate which is tailored not to find any matches, but somehow I'd rather find a way to execute a precise fetch using the NSSearchField instead of unnecessarily loading a lot of bloat into memory and only to narrow that down again for display.

At least this is how I assume the standard controller filter bindings work - or does the filtering really execute a fetch on core data behind the scenes? If the latter is the case it would eventually suffice to prevent data from being displayed for empty filter values.

Any insights?
Has anybody done something like this?

Any pointers are appreciated!

Thanks!

Peter
_______________________________________________

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

  • Prev by Date: NSFileManager directory lists and hidden files
  • Next by Date: Re: NSFileManager directory lists and hidden files
  • Previous by thread: Re: NSFileManager directory lists and hidden files
  • Next by thread: slow first context menu
  • Index(es):
    • Date
    • Thread