开发者

One of Two Bound Tableviews Not Updated for Changes in Other Table

I have an OS X app that uses a splitview with two embeded NSTableViews. Changing a value in one table view should change a related value in the second but this does not happen.

It uses CoreData using databinding and not glue code. There is an NSArrayController for each of the TableViews. The initial window comes up with expected data in The first (left TableView) that is:

American Travel <-- selected
Browse All
Fiction
Science Fiction

The corresponding data for American Travel books appears in the second (right TableView), namely a list of travel books This is because the second controllers Content Set is set to:

leftController.selection.books

This means I have the TableColumns bound to the right data. I see no warnings that appear related to this problem of failure to update the second TableView following a new selection in the first TableView. I believe an Observer is setup automatically by the system, that observes a change in selection in the Left ArrayController.

In Attribute Inspector for both ArrayController Checked are:

Avoid Empty Selection
Preserve Selection
Select Inserted Objects
Auto Rearrange Content

Value Binding for single TableColumn of RightController - bookList

Bind to : RightController
Controller Key : arranged Objects
ModelKey Path : name

My Question:

The problem I have is that the data in the right/second/book_names does not change when I change the selection in the left/first/book-types

TableView. Where do I look to solve this. I know it is something very small, like a checkbox. I simply can not find it!

/// Begin Category.h
@class Book;

@interface Category : NSManagedObject {
}
@property (nonatomic, retain) NSSet * books;
@property (nonatomic, retain) NSString * name;// name of book_category

......

MORE INFO ADDED 4/13/2011

I have added a button which is connected an action in the

LeftArrayController(Category) namely, selectNext: . When I click 

the button, the selection in the CATEGORY Tab开发者_如何学PythonleView does not

visibly change, but the TableView on the right (Books) does change, 

as the list of books on the Right continually changes. 

If I click the TableView with the mouse, no selection change is done 

either in effect on the RightTableView or in the visible

sense on the Left TableView. Why is the mouseClick not effecting a 

visible change int the TableViewColumn? That is, why is the mouse 

unable to change selection, whereas the button is able to. 

There is only one column in the TableView. In Attributes Inspector I have

tried all combination of Empty,Column and Type Select for this single selection

Table. Is there no way around using NSTableView Delegate methods to set selection?


This was a case of User Error. I had errors in my DataModel. Entities had relationships as stand-ins for the Class NSSet* properties. One of these relationships was set as 1 to 1 and needed to be 1 to Many. The two tables are now working!! Thanks very much to those how read this. I knew I had made some dumb error, when I received no comments. I hope this helps someone in the future.

Mark

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜