- Bind your
NSSearchField
to the sameNSArrayController
you use for theNSTableView
- In bindings for your
NSSearchField
under Search and Predicate set the Controller Key tofilterPredicate
and Display Name topredicate
- Under Predicate Format write something like:
self.name contains[cd] $value
Binding NSArrayController to NSSearchField and viewing result in NSTableView
-
03-08-2022 - |
Question
My app description,
- Add
NSMutableArray
with some items (say 1- 50) - Add
NSArrayController
and add/bind that array to this arrayController - Add
NSTableView
to my view and populate them using the concept of BINDINGS. - Finally add a
NSSearchField
and complete the app by adding/binding the NSArrayController with searchField.
I would like to know if this approach is how it is meant to be, I have searched but couldn't find a way of displaying populated arrays in a NSTableView
using NSArrayController
binds.
Help me through.
Solution
OTHER TIPS
If you wish to combine several predicates, follow Mikael steps and do:
- Under Predicate Format write something like:
(self.name contains[cd] $value) OR (self.title contains[cd] $value)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow