更新时间:2022-05-01 22:56:29
无法在目录模型和其他模型类型之间创建关系.您至少可以通过三种方法来解决此短缺问题:
There is no way to create relations between Directory Model and other model types. You have at least three ways to workaround this shortage:
一个
动态查询目录记录-可以很好地处理单记录页面,但是对于列表来说太慢了.
Query directory records on the fly - this will okish work for single-record pages, but it will be tooo slow for lists.
两个
您可以在表中复制所需的目录字段.
You can duplicate Directory fields you need in your tables.
优点:
缺点:
您可以在中找到第二种方法的不错的示例 人际交往应用.
You can find nice sample of the second approach in People Skills app.
三个
按需查询目录数据.假设您有数据绑定列表,并且绑定到列表的记录具有UserEmail字段.在这种情况下,您可以:
Query Directory data on demand. Let's say you have databound list, and records bound to the list have UserEmail field. In this case you can:
app.datasources.Directory.query.filters.PrimaryEmail._equals = widget.datasource.item.UserEmail;
app.datasources.Directory.load();
app.showPage(app.pages.UserDetails); // or app.showDialog(app.pages.UserDetails);