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. Redis自动化安装以及集群实现

    Redis实例安装 安装说明:自动解压缩安装包,按照指定路径编译安装,复制配置文件模板到Redis实例路的数据径下,根据端口号修改配置文件模板 三个必须文件:1,配置文件,2,当前shell脚本,3, ...

  2. Git 如何优雅地回退代码

    前言 从接触编程就开始使用 Git 进行代码管理,先是自己玩 Github,又在工作中使用 Gitlab,虽然使用时间挺长,可是也只进行一些常用操作,如推拉代码.提交.合并等,更复杂的操作没有使用过, ...

  3. 简单理解http协议的特性

    http协议一种数据传输的规范,像我们的在发送数据的时候,我们无法保证发送与接收的类型是一致的,它就保证了我们传输的同一个类型数据. 特性: 1.灵活:我们不管传输什么数据,图片,文件,文字,都可以进 ...

  4. mac端口占用

    lsof -i tcp:port 可以查看该端口被什么程序占用,并显示PID port 替换成端口号, eg: lsof -i tcp:8081 kill pid 杀死PID

  5. 往Github上,上传本地项目

    1.先申请一个Github的帐号,创建一个仓库. 复制这个仓库的地址: 创建完空仓库,页面下方会有提示代码,告诉怎么操作 在本地的项目下依次执行下面的代码: git init   //在本地创建git ...

  6. C++ 并发编程指南(收藏笔记)

    git地址: https://github.com/forhappy/Cplusplus-Concurrency-In-Practice https://github.com/forhappy/Cpl ...

  7. Java多态之动态绑定

    目录 Java多态之动态绑定 引用变量的类型 编译时类型 运行时类型 方法绑定 静态绑定 动态绑定 方法表 Java多态之动态绑定 上篇回顾:多态是面向对象程序设计非常重要的特性,它让程序拥有 更好的 ...

  8. 【React】282- 在 React 组件中使用 Refs 指南

    英文:Yomi Eluwande  译文:joking_zhang https://segmentfault.com/a/1190000019277029 使用 React 时,我们的默认思维方式应该 ...

  9. python笔记03

    day03 一.今日内容: 1.整型 2.字符串 3.布尔类型 二.内容回顾和补充 脑图--xmind软件,processon 1.运算符补充(in.not in) value = "我是中 ...

  10. 成为java高手的成长历程想学好java必看

    1:J2SE入门阶段(3-6个月) 学习内容:J2SE常用类,JDBC等等 动态绑定,反射机制等 2:J2EE入门阶段(3个月) 学习内容:JSP/Servlet/JavaBean MVC结构的概念 ...