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.
Asked
Active
Viewed 2,790 times
6
-
+1 for nice question on mac osx. – Anoop Vaidya Jan 29 '13 at 05:07
1 Answers
6
I have a project that you can download and look how it works.
The steps are as :
Drag NSArrayController, set all bindings with this. Create NSSearchField.
In binding inspector, Search "Bind to ArrayController".
Set Controller Key to "filterPredicate".
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.

Community
- 1
- 1

Anoop Vaidya
- 46,283
- 15
- 111
- 140
-
Not yet AKV. i couldn't download the project. There is some problem in net here. – user1999892 Jan 29 '13 at 05:58
-
-
this is a great example. thanks a ton! one small fix: click the search field, go into bindings>search>predicate>format and replace the last salary with name. – kritzikratzi Jul 10 '15 at 15:14
-
@AnoopVaidya the project link is broken... could you please fix it or better put it on github? much appreciated! :) – Lookaji Oct 24 '18 at 20:49