Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Binding search field and table view in cocoa

I have a nstableview. I would like to filter the results based on the characters entered in a search bar in OSX. So how do i bind the table view and the search field in OSX not in IOS? :) Thanks.

like image 888
user1999892 Avatar asked Jan 28 '13 13:01

user1999892


1 Answers

I have a project that you can download and look how it works.

The steps are as :

  1. Drag NSArrayController, set all bindings with this. Create NSSearchField.

  2. In binding inspector, Search "Bind to ArrayController".

  3. Set Controller Key to "filterPredicate".

  4. Set Predicate Format to "property1 contains $value" If you want a single search field to search on multiple values(say 3) use || as : "property1 contains $value || property2 contains $value || property3 contains $value"

Also, this StackOverFlow Question.

like image 92
Anoop Vaidya Avatar answered Sep 28 '22 05:09

Anoop Vaidya