两个绑定表视图之一未针对其他表中的更改进行更新

发布于 2024-10-31 18:50:24 字数 2179 浏览 7 评论 0原文

我有一个 OS X 应用程序,它使用带有两个嵌入 NSTableView 的 splitview。更改一个表视图中的值应该会更改第二个表视图中的相关值,但这种情况不会发生。

它使用 CoreData 使用数据绑定而不是粘合代码。有一个 每个 TableView 的 NSArrayController。初始窗口 在第一个(左 TableView)中出现预期数据,即:

American Travel <-- selected
Browse All
Fiction
Science Fiction

美国旅游书籍的相应数据 出现在第二个(右TableView),即旅游书籍列表 这是因为第二个控制器内容集设置为:

leftController.selection.books

这意味着我将 TableColumns 绑定到正确的数据。 我没有看到与此问题相关的警告 无法更新第二个 TableView 后的新表 在第一个 TableView 中进行选择。我相信观察者是 由系统自动设置,观察变化 在左侧 ArrayController 中进行选择。

在两个 ArrayController 的属性检查器中检查的是:

Avoid Empty Selection
Preserve Selection
Select Inserted Objects
Auto Rearrange Content

RightController 的单个 TableColumn 的值绑定 - bookList

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

我的问题:

我遇到的问题是 right/second/book_names 中的数据 当我更改左侧/第一/书籍类型中的选择时不会更改
表视图。我该去哪里解决这个问题。我知道这是非常重要的事情 小,像一个复选框。我根本找不到它!

/// Begin Category.h
@class Book;

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

......

更多信息添加于 2011 年 4 月 13 日

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 TableView 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?

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 TableView 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萧瑟寒风 2024-11-07 18:50:24

这是一个用户错误的案例。我的数据模型中有错误。实体之间存在关系
作为 NSSet* 类属性的替代品。其中一个关系被设置为
一对一,并且需要一对多。两个表现在都可以工作了!
非常感谢那些阅读本文的人。我知道我犯了一些愚蠢的错误
当我没有收到任何评论时。我希望这对将来的人有帮助。

标记

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文