English 中文(简体)
Making a table s display dependent on the selection in another table in Interface Builder
原标题:

I ve got a window set up with two NSTableViews. In Core Data I have two entities set up, one of them containing members of the other, larger grouping (e.g. cars and manufacturers). I ve got entry pages set up for each entity and they play nicely there (no faulting when trying to select from a many-to-one in a drop menu). What I m trying to do now is take that one step further so that when I select a manufacturer in the main NSTableView, the list of cars related to that manufacuturer will appear in the second NSTableView.

I ve tried using bindings similar to what I ve done for the manufacturer popup button, feeding the value from the cars entity, however it s simply showing a list of all the car entries, regardless of which manufacturer I select. I don t see any options for a predicate to filter it, however, and if I set the binding s key path to manufacturer.cars, it shows a relationship fault. How can I filter what gets displayed in the child table?

最佳回答

Have two NSArrayControllers. Bind the contentArray of the cars controller to the manufacturers controller; the controller key is selection (i.e., the selected manufacturer), and the model key path is that of the property containing the manufacturer s cars.

Then, bind the cars table view s columns to properties of the cars controller s arrangedObjects.

问题回答

暂无回答




相关问题
Taking picture with QTCaptureView

Is it possible to simply take a picture and save it somewhere using a QTCaptureView and Apple s built-in iSight? I ve seen lots of tutorials on recording video but none on simply taking a picture. Any ...

Controlling OSX windows

I m trying to control windows of a foreign OSX applications from my application. I d like to 1. move the windows on the screen 2. resize the windows on the screen 3. change the currently active window ...

objective-c: Calling a void function from another controller

i have a void, like -(void) doSomething in a specific controller. i can call it in this controller via [self doSomething], but i don t know how to call this void from another .m file. I want to call ...

NSUndoManager and runModalForWindow:

I have a simple Core Data app which displays a list of entities in the main window. To create or add new entities, I use a second modal window with a separate managed object context so changes can be ...

NSMutableArray values becoming "invalid"

I m trying to show a database information in a tableview and then the detailed information in a view my problem is as follow: I created a NSMutableArray: NSMutableArray *myArray = [[NSMutableArray ...

How to get a flash url in a webpage using a webframe?

As we know , When we load frame from webpage of safari, we will invoke the delegate methods of webkit informal protocol(WebFrameLoadDelegate): webView:didStartProvisionalLoadForFrame: webView:...

热门标签