Filter Lookup Editor Data Source 筛选器查找编辑器数据源
In this lesson, you will learn how to filter the data displayed by a lookup editor. This editor is shown in the Detail Views for reference properties. It contains a list of objects of another related class. In this lesson, the Contact.Position lookup editor will be filtered. For this purpose, a Many-to-Many relationship will be set between the Position class and the Department class. Then, the objects of the Position class in the Detail View of the Contact object will be filtered, displaying only those Positions that are related to a corresponding Department.
在本课中,您将学习如何筛选查找编辑器显示的数据。此编辑器显示在参考属性的"详细信息视图"中。它包含另一个相关类的对象列表。在本课中,将筛选联系人.位置查找编辑器。为此,将在职位类和部门类之间设置多对多关系。然后,将筛选"联系人"对象"详细信息视图中的"位置"类的对象,仅显示与相应部门相关的位置。
Note 注意
Before proceeding, take a moment to review the following lessons:
在继续之前,请花点时间复习以下课程:
- Inherit from the Business Class Library Class (XPO/EF)
- Implement Custom Business Classes and Reference Properties (XPO/EF)
- Implement Dependent Reference Properties (XPO/EF)
- Set a Many-to-Many Relationship (XPO/EF)
- Place an Action in a Different Location
Set a Many-to-Many relationship between the Position and Department classes. For details, refer to the Set a Many-to-Many Relationship (XPO/EF) lesson.
从商务舱库类 (XPO/EF) 继承
实现自定义业务类和参考属性 (XPO/EF)
实现从属参考属性 (XPO/EF)
设置多对多关系 (XPO/EF)
将操作放置在其他位置
在职位和部门类之间设置多对多关系。有关详细信息,请参阅设置多对多关系 (XPO/EF) 课程。
eXpress Persistent Objects
eXpress 持久对象
[DefaultClassOptions]
[System.ComponentModel.DefaultProperty(nameof(Title))]
public class Department : BaseObject {
//...
[Association("Departments-Positions")]
public XPCollection<Position> Positions {
get { return GetCollection<Position>(nameof(Positions)); }
}
} [DefaultClassOptions]
[System.ComponentModel.DefaultProperty(nameof(Title))]
public class Position : BaseObject {
//...
[Association("Departments-Positions")]
public XPCollection<Department> Departments {
get { return GetCollection<Department>(nameof(Departments)); }
}
}
Entity Framework
实体框架
public class Position {
public Position() {
//...
Departments = new List<Department>();
}
//...
public virtual IList<Department> Departments { get; set; }
}
C#
VB.NET
public class Department {
public Department() {
//...
Positions = new List<Position>();
}
//...
public virtual IList<Position> Positions { get; set; }
}
- Invoke the Model Editor for the MySolution.Module project. Navigate to the BOModel | MySolution.Module.BusinessObjects node. Expand the Contact child node and select the Position child node. The properties to the right define the Contact.Position property. Set the DataSourceProperty property to "Department.Positions". As a result, the Position lookup editor will display the Department.Positions collection.
Set the DataSourcePropertyIsNullMode property to "SelectAll", to display all existing objects in the Contact.Position editor when the Department.Positions property is not specified.
调用 MySolution.模块项目的模型编辑器。导航到 BOModel |MySolution.模块.业务对象节点。展开"联系人子节点"并选择"位置子节点"。右侧的属性定义"联系人.位置"属性。将 DataSource 属性属性设置为"部门.位置"。因此,"位置查找"编辑器将显示"部门.位置"集合。
将 DataSourcePropertyIsNullMode 属性设置为"选择全部",以在未指定"部门位置"属性时在"联系人.位置"编辑器中显示所有现有对象。

Note 注意
You can perform the task defined above in code. See the Implement Dependent Reference Properties (XPO) topic.
您可以执行上面在代码中定义的任务。请参阅实现相关引用属性 (XPO) 主题。
The data source for the Position property is changed each time the Department property is changed. So, the Position property value should be set to "null" ("Nothing" in VB) after its data source has changed. To set a new value from the recreated data source, replace the Department property declaration with the following code.
每次更改"部门"属性时,都会更改"位置"属性的数据源。因此,在 VB 中的数据源发生更改后,位置属性值应设置为"空"("无"。要从重新创建的数据源设置新值,请将"部门"属性声明替换为以下代码。
eXpress Persistent Objects
eXpress 持久对象
[Association("Department-Contacts", typeof(Department)), ImmediatePostData]
public Department Department {
get {return department;}
set {
SetPropertyValue(nameof(Department), ref department, value);
if(!IsLoading) {
Position = null;
if(Manager != null && Manager.Department != value) {
Manager = null;
}
}
}
}
Note 注意
The similar functionality can not be implemented for the Entity Framework because the current version of EF does not allow to check where are the assignment signal comes from.
无法为实体框架实现类似的功能,因为当前版本的 EF 不允许检查分配信号的来源。
Run the WinForms or ASP.NET application. Specify the Positions property for Department objects. Invoke a Contact Detail View. The dropdown list for the Position lookup editor contains the Positions assigned to the Department object that is specified by the Department editor:
运行 WinForms 或ASP.NET应用程序。指定"部门"对象的"位置"属性。调用联系人详细信息视图。职位查找编辑器的下拉列表包含分配给部门对象的位置,由部门编辑器指定:


You can see the changes made in this lesson in the Main Demo | MainDemo.Module project. The MainDemo application is installed in %PUBLIC%\Documents\DevExpress Demos 19.2\Components\eXpressApp Framework\MainDemo by default. The ASP.NET version is available online at http://demos.devexpress.com/XAF/MainDemo/
您可以在主演示中看到本课中所做的更改 |主演示模块项目。主演示应用程序安装在%PUBLIC%\Documents\DevExpress Demos 19.2\Components\eXpressApp Framework\MainDemo by default. The ASP.NET version is available online at http://demos.devexpress.com/XAF/MainDemo/
.
Filter Lookup Editor Data Source 筛选器查找编辑器数据源的更多相关文章
- Filter List Views 筛选器列表视图
In this lesson, you will learn how to filter a List View. Three techniques, based on different scena ...
- mvc 筛选器
之前公司中,运用ActionFilterAttribute特性实现用户登录信息的验证,没事看了看,留下点东西备忘. 好的,瞅这玩意一眼就大概能猜到这货是干嘛的了吧,没错,action过滤器.其实就是A ...
- jQuery: 选择器,筛选器
jQuery 简介 jQuery由美国人John Resig创建,至今已吸引了来自世界各地的众多 javascript高手加入其team. jQuery是继prototype之后又一个优秀的Javas ...
- ASP.NET MVC 全局过滤器(FilterConfig)、标记在控制器上和方法上的筛选器执行顺序
FilterConfig->控制器上的筛选器-->方法上的筛选器(大-->小,上-->下) 全局-->控制器->个别 尝试的时候记得把返回true protecte ...
- 什么是 jQuery 和jQuery的基本选择器,层级选择器,基本筛选器
jQuery是什么? [1] jQuery由美国人John Resig创建,至今已吸引了来自世界各地的众多 javascript高手加入其team. [2] jQuery是继prototype ...
- datatbales的数据源类型(Data source types)
数据是复杂的,并且所有的数据是不一样的.因此 DataTables 中有很多的选项可用于配置如何获得表中的数据显示,以及如何处理这些复杂的数据. 本节将讨论 DataTables 处理数据的三个核心概 ...
- jQuery 选择器 筛选器 样式操作 文本操作 属性操作 文档处理 事件 动画效果 插件 each、data、Ajax
jQuery jQuery介绍 1.jQuery是一个轻量级的.兼容多浏览器的JavaScript库. 2.jQuery使用户能够更方便地处理HTML Document.Events.实现动画效果.方 ...
- jQuery查找标签--选择器,筛选器,模态对话框, 左侧菜单栏
查找标签 选择器: 基本选择器(同css) id选择器 $("#id") 标签选择器 $('tagName') class选择器 $(".className") ...
- jquery查找筛选器
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
随机推荐
- 基于SpringBoot+Netty实现一个自己的推送服务系统
目标 实现一个WebSocket服务中心,支持水平扩展 技术栈 SpringBoot.Netty.JDK8.MySQL.Redis.RabbitMQ.MyBatis-Plus 环境搭建 主要功能点说明 ...
- JavaScript的函数申明、函数表达式、箭头函数
JavaScript中的函数可以通过几种方式创建,如下. // 函数声明 function getName() { return 'Michael' } // 函数表达式 const getName ...
- luogu P4064 [JXOI2017]加法
题目描述 可怜有一个长度为 n 的正整数序列 A,但是她觉得 A 中的数字太小了,这让她很不开心. 于是她选择了 m 个区间 [li, ri] 和两个正整数 a, k.她打算从这 m 个区间里选出恰好 ...
- luogu P2296 寻找道路 |最短路
题目描述 在有向图 G 中,每条边的长度均为 1,现给定起点和终点,请你在图中找一条从起点到终点的路径,该路径满足以下条件: 路径上的所有点的出边所指向的点都直接或间接与终点连通. 在满足条件 1 的 ...
- Tomcat下载安装并部署到IDEA(附带idea两种热部署设置方法)
目录 Tomcat下载教程 Tomcat安装教程 Tomcat热部署到IDEA idea两种热部署设置方法 使用Idea的时候,修改了代码,需要反复的重启Tomcat,查看效果,是不是贼烦?还记得刚上 ...
- vue 各种打包坑
1,报错 Refused to load the image 'http://localhost:8080/favicon.ico' because it violates the following ...
- WWDC 2016 盛宴
转自:http://www.jianshu.com/p/72dd8306c817 整理和维护人:pmstGitHub 链接:WWDC-2016-Feast目前只是整理官方给出的 WWDC 2016 视 ...
- CF1009F Dominant Indices(启发式合并)
You are given a rooted undirected tree consisting of nn vertices. Vertex 11 is the root. Let's denot ...
- Django 2.0.7 使用小知识
Django 2.0.3 使用小知识 运行环境: Python 3.6.4 Django 2.0.7 Django Admin中model显示为中文 定义model时,定义一个Meta对象,设置需要显 ...
- 在ASP.NET Core中使用托管启动(hosting startup)程序集,实现批量注册service
在启动ASPNET Core时可以从外部程序集向应用添加增强功能.例如,外部库可以用托管启动( hosting startup) 实现为应用程序提供附加配置(Configuration)或服务(ser ...