• DevExpress.Data.Filtering.Helpers.LikeData.CreateContainsPattern已过时


    View Code
       protected override string OnCreateLookupDisplayFilter(string text, string displayMember)
            {
                List<CriteriaOperator> subStringOperators = new List<CriteriaOperator>();
                foreach (string sString in text.Split(' '))
                {
                    string exp = DevExpress.Data.Filtering.Helpers.LikeData.CreateContainsPattern(sString);
                    List<CriteriaOperator> columnsOperators = new List<CriteriaOperator>();
                    foreach (GridColumn col in Columns)
                    {
                        if (col.Visible && col.ColumnType == typeof(string))
                            columnsOperators.Add(new BinaryOperator(col.FieldName, exp,BinaryOperatorType.Like));
                    }
                    subStringOperators.Add(new GroupOperator(GroupOperatorType.Or, columnsOperators));
                }
                return new GroupOperator(GroupOperatorType.And, subStringOperators).ToString();
            }

    修改成以下代码

    View Code
          protected override string OnCreateLookupDisplayFilter(string text, string displayMember)
            {
                List<CriteriaOperator> subStringOperators = new List<CriteriaOperator>();
                foreach (string sString in text.Split(' '))
                {
                    List<CriteriaOperator> columnsOperators = new List<CriteriaOperator>();
                    foreach (GridColumn col in Columns)
                    {
                        if (col.Visible && col.ColumnType == typeof(string))
                            columnsOperators.Add(new FunctionOperator(FunctionOperatorType.Contains, new OperandProperty(col.FieldName), sString));
                    }
                    subStringOperators.Add(new GroupOperator(GroupOperatorType.Or, columnsOperators));
                }
                return new GroupOperator(GroupOperatorType.And, subStringOperators).ToString();
            }

    以上代码来源官网论坛

  • 相关阅读:
    kakfa 入门
    Spring Boot maven构建——阿里云Maven仓库地址
    MongoDB入门一
    MongoDB入门
    mybatis 一对一、一对多、多对一、多对多
    springboot集成druid数据源并且监控
    java 过滤表情符号
    Mybatis框架
    表单(一)
    HTML标签(二)
  • 原文地址:https://www.cnblogs.com/freexiaoyu/p/2694875.html
Copyright © 2020-2023  润新知