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. css4——浮动

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

  2. 机器学习笔记(九)---- 集成学习(ensemble learning)【华为云技术分享】

    集成学习不是一种具体的算法,而是在机器学习中为了提升预测精度而采取的一种或多种策略.其原理是通过构建多个弱监督模型并使用一定策略得到一个更好更全面的强监督模型.集成学习简单的示例图如下: 通过训练得到 ...

  3. 华为云ModelArts 2.0全面升级,革新传统AI开发模式

    [中国,上海,9月20日] 在HUAWEI CONNECT 2019期间,华为云EI服务产品部总经理贾永利宣布--华为云AI重装升级,并重磅发布一站式AI开发管理平台ModelArts 2.0. 现场 ...

  4. Dict.setdefault()

    """ setdefault方法参数输入已有键,返回对应值,找不到已有键,创建新键,值为None """ >>> dict ...

  5. python数据处理----常用数据文件的处理

    数据处理时,常用数据存储形式主要有:CSV.JSON.XML.EXCEL.数据库存储. 一.CSV文件 csv文件简介 CSV是一种通用的.相对简单的文件格式,被用户.商业和科学广泛应用.最广泛的应用 ...

  6. RocketMQ 主题扩分片后遇到的坑

    目录 1.案情回顾 1.1 集群现状 1.2.RocketMQ 在线扩容队列 1.3 消息发送 2.问题暴露 3.问题分析 4.问题复盘 消息组接到某项目组反馈,topic 在扩容后出现部分队列无法被 ...

  7. 洛谷 题解 P3385 【【模板】负环】

    一.声明 在下面的描述中,未说明的情况下,\(N\) 是顶点数,\(M\)是边数. 二.判负环算法盘点 想到判负环,我们会想到很多的判负环算法.例如: 1. Bellman-Ford 判负环 这个算法 ...

  8. 简单了解一下K8S,并搭建自己的集群

    距离上次更新已经有一个月了,主要是最近工作上的变动有点频繁,现在才暂时稳定下来.这篇博客的本意是带大家从零开始搭建K8S集群的.但是我后面一想,如果是我看了这篇文章,会收获什么?就是跟着步骤一步一走吗 ...

  9. 跨站脚本(XSS)备忘单-2019版

    这是一份跨站脚本(XSS)备忘录,收集了大量的XSS攻击向量,包含了各种事件处理.通讯协议.特殊属性.限制字符.编码方式.沙箱逃逸等技巧,可以帮助渗透测试人员绕过WAF和过滤机制. 译者注:原文由Po ...

  10. art-template与swiper发生冲突导致swiper的一些样式不起作用

    我们在实际中的前后端分离开发中,在进行渲染后端返回来的数据时我们有时会用到模板来进行渲染数据,而在渲染数据中我们可能用到一些组件来进行一些样式显示.而在页面中数据显示了导致组件的一些样式没有显示,一些 ...