• 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: Hiding Rows in NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hiding Rows in NSTableView


  • Subject: Re: Hiding Rows in NSTableView
  • From: Scott Stevenson <email@hidden>
  • Date: Mon, 18 Apr 2005 13:43:33 -0700


On Apr 18, 2005, at 11:13 AM, Jason Taylor wrote:

When the table is reloaded, the items that are checked off will not show up. In the tableView: objectValueForTableColumn:row datasource method, I check each object of my data source array to see if it is 'completed'. If it is not, I display it, otherwise I don't. The problem is that once I hide an item, the row indexes of the table no longer match the row indexes of my data source array (for instance hiding the first item in the table with row index 0 will hide the object in my data source array with index 0

The easiest solution is to use bindings, and create a subclass of NSArrayController.


The subclass should override -arrangeObjects:, and return just the items that match your criteria. This abstracts you from dealing with the source data directly.

Here's an example:
http://homepage.mac.com/mmalc/CocoaExamples/FilteringController.zip


- Scott

--
http://treehouseideas.com/
http://theocacao.com/ [blog]

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Hiding Rows in NSTableView (From: Jason Taylor <email@hidden>)

  • Prev by Date: Re: Gracefully failing on unsupported OS version
  • Next by Date: upper limit on retain count
  • Previous by thread: Hiding Rows in NSTableView
  • Next by thread: Re: Hiding Rows in NSTableView
  • Index(es):
    • Date
    • Thread