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 筛选器查找编辑器数据源的更多相关文章

  1. Filter List Views 筛选器列表视图

    In this lesson, you will learn how to filter a List View. Three techniques, based on different scena ...

  2. mvc 筛选器

    之前公司中,运用ActionFilterAttribute特性实现用户登录信息的验证,没事看了看,留下点东西备忘. 好的,瞅这玩意一眼就大概能猜到这货是干嘛的了吧,没错,action过滤器.其实就是A ...

  3. jQuery: 选择器,筛选器

    jQuery 简介 jQuery由美国人John Resig创建,至今已吸引了来自世界各地的众多 javascript高手加入其team. jQuery是继prototype之后又一个优秀的Javas ...

  4. ASP.NET MVC 全局过滤器(FilterConfig)、标记在控制器上和方法上的筛选器执行顺序

    FilterConfig->控制器上的筛选器-->方法上的筛选器(大-->小,上-->下) 全局-->控制器->个别 尝试的时候记得把返回true protecte ...

  5. 什么是 jQuery 和jQuery的基本选择器,层级选择器,基本筛选器

    jQuery是什么? [1]   jQuery由美国人John Resig创建,至今已吸引了来自世界各地的众多 javascript高手加入其team. [2]   jQuery是继prototype ...

  6. datatbales的数据源类型(Data source types)

    数据是复杂的,并且所有的数据是不一样的.因此 DataTables 中有很多的选项可用于配置如何获得表中的数据显示,以及如何处理这些复杂的数据. 本节将讨论 DataTables 处理数据的三个核心概 ...

  7. jQuery 选择器 筛选器 样式操作 文本操作 属性操作 文档处理 事件 动画效果 插件 each、data、Ajax

    jQuery jQuery介绍 1.jQuery是一个轻量级的.兼容多浏览器的JavaScript库. 2.jQuery使用户能够更方便地处理HTML Document.Events.实现动画效果.方 ...

  8. jQuery查找标签--选择器,筛选器,模态对话框, 左侧菜单栏

    查找标签 选择器: 基本选择器(同css) id选择器 $("#id") 标签选择器 $('tagName') class选择器 $(".className") ...

  9. jquery查找筛选器

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

随机推荐

  1. Modelarts与无感识别技术生态总结(浅出版)

    [摘要] Modelarts技术及相关产业已成为未来AI与大数据重点发展行业模式之一,为了促进人工智能领域科学技术快速发展,modelarts现状及生态前景成为研究热点.笔者首先总结modelarts ...

  2. 从自动化到智能化,网易杭研的AIOps探索与实践

    在大数据时代下,我们借助机器学习.数据仓库.大数据平台等大数据技术手段,将运维产生的数据进行分析.处理,得出最佳运维策略,以期实现对故障的事先干预,将风险降低到最低,从而降低运维成本,提升运维效率,最 ...

  3. 数据库Oracle和MySQL 的不同

    实例区别: MySQL是轻量型数据库,开源免费.Oracle收费,这个不是重点,,重点是它贵. MySQL一个实例可以操作多个库,而Oracle一个实例只能对应一个库. MySQL安装只有300多兆, ...

  4. 洛谷 题解 P2312 【解方程】

    Problem P2312 [解方程] >>> record 用时: 1166ms 空间: 780KB(0.76MB) 代码长度: 2.95KB 提交记录: R9909587 > ...

  5. Oracle:row_number()、rank()、dense_rank()

    语法:ROW_NUMBER()  OVER(): row_number的用途非常广泛,排序最好用它,它会为查询出来的每一行记录生成一个序号,依次排序且不会重复,注意使用row_number函数时必须要 ...

  6. linux运维中经常使用的目录和文件讲解

    第9章 linux中目录结构 9.1 linux中的常见目录和解释说明 ID 目录 说明 1 bin 命令文件保存的地方 2 sbin 只有root用户才可以使用的命令 3 Boot(了解即可) Li ...

  7. Docker学习-环境搭建

    ChuanGoing 2019-12-15 本篇是DevOps Docker介绍第一篇,首先说下为何另开一篇来讲解本系列. 原因有二: 1.重新复习下个人对于DevOps/Docker的学习之路 2. ...

  8. 用C语言开发的19个经典项目,你会第几个?

    前言本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理.作者:实验楼 C语言是我们大多数人的编程入门语言,对其也再熟悉不过了,不过很多 ...

  9. 【关注图像采集视频传输】之 Cy3014 usb3.0 FIFO接口

    CYUSB3014延续了CY7C68013A最吸引人的地方,那就是实现高速数据传输的Slave FIFO接口,应用这种模式,据说数据传输率可以达到320MB/s. 同USB2.0的芯片CY7C6801 ...

  10. 【JS】380- JavaScript 正则新特性

    概括 如果你曾用 JavaScript 进行过复杂的文本处理操作,那么你将会喜欢 ES2018 中引入的新特性.本文将详细介绍第9版标准如何提高 JavaScript 的文本处理能力. 大多数编程语言 ...