ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

kendoGrid filter过滤

2021-09-01 13:03:29  阅读:155  来源: 互联网

标签:title filterable kendoGrid 查询 filter field 过滤 dataSource true


过滤主要分为三种(都是针对列进行过滤):

1.多条件查询

$("#grid").kendoGrid({
    filterable:{
        extra: false,    //是否显示其他的查询条件,默认为true,如果为false,则为单条件查询
        //具体的操作类型,可设置
        operators: {
              string: {
                  startswith: "Starts with",
                  eq: "Is equal to",
                  neq: "Is not equal to"
                   }
         }
    },
    columns:[
         { field: "state", title:"状态", width: 100, filterable:    
            { 
              ui: function(element){
                 //下拉列表
                 element.kendoDropDownList({
                    dataSource: ['AAA','BBB'],
                    optionLabel: "--Select Value--"
                 });
             }
          } }
    ]
})

效果图:

 

 

 

 

 

 

2.单条件查询

这种查询方式,是直接出来查询的一行,可以在列设置里面设置默认的查询方式

$("#grid").kendoGrid({
    filterable:{
         mode:'row'    
    },
   columns:[
      { field: name, title:title, width: 100,
            filterable:{ cell:{ 
                operator:'contains',      //默认模糊查询
               suggestionOperator:'contains',    //查询提示内容
               showOperators:false       //右侧过滤按钮是否去掉
             } } 
     }
  ] 
})

 

 

 

 

3.带checkbox的查询 

$("#grid").kendoGrid({
    filterable: true,
    columns:[
         { field: "state", title:"状态", width: 100, filterable: { 
               multi: true,     //checkbox选择
               search: true,   //是否显示输入查询框
               dataSource: [{ Discontinued: true }, { Discontinued: false }]    //显示的数据
          } }
    ]
})

效果图:

 

 

 

 如果数据一开始加载就需要一些条件查询,可在dataSource中设置

var dataSource = new kendo.data.DataSource({
   data:data,
   filter: {
     logic: "or",    //多个条件查询的操作类型
     filters: [
        {field: "businessNo", operator: "eq", value: "4500278309"},      //过滤条件
        {field: "businessNo", operator: "eq", value: "4500278012"}
     ]
   }            
});

来自:https://www.cnblogs.com/zsj-02-14/p/9590949.html

 

标签:title,filterable,kendoGrid,查询,filter,field,过滤,dataSource,true
来源: https://www.cnblogs.com/djd66/p/15214133.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有