• 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
Re: TableView delegation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TableView delegation


  • Subject: Re: TableView delegation
  • From: Brian Webster <email@hidden>
  • Date: Tue, 22 Jan 2002 16:03:51 -0600

On Tuesday, January 22, 2002, at 03:49 PM, cocoa-dev-
email@hidden wrote:

As the number of rows within the TableView grows quite lengthy, I'd like to
provide a quick way of filtering rows by adding a TextField above the
TableView into which a user could type the first or last name of the
individual, and as the user types, the TableView filters records containing
only the characters typed. This would be equivalent to the filtering of
emails available within Entourage.

Is this properly handled with a delegate method such as:

- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(int)rowIndex

This method determines what rows in the table the user can select (highlight). All the rows will still show up in the table, but the user can only select rows for which this method returns YES.

To do what you want, you'll want to do a search when the user types something in the text field and store those records in a second NSMutableArray, and then alter your data source methods to return results from this filtered array rather than the one holding all of your records.

--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster


  • Prev by Date: Re: Question about movePath
  • Next by Date: Re: Initializing an Array
  • Previous by thread: TableView delegation
  • Next by thread: Embedded database engine in Cocoa?
  • Index(es):
    • Date
    • Thread