zoukankan      html  css  js  c++  java
  • jqGrid Search

    表格中所有的列都可以作为搜索条件。 
    所用到的语言包文件

    · $.jgrid = {  

    · ...  

    ·    search : {  

    ·      caption: "Search...",  

    ·      Find: "Find",  

    ·      Reset: "Reset",  

    ·      odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],  

    ·      groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ],  

    ·      matchText: " match",  

    ·      rulesText: " rules"  

    ·    }

    colModel 设置

    可选参数

    类型

    说明

    默认值

    search

    boolean

    是否是搜索列

    true

    stype

    string

    搜索类型,text类型或者select类型

    text

    searchoptions

    object

    对搜索条件进行一些设置

    searchoptions 参数

    属性

    类型

    说明

    dataUrl

    string

    只有当搜索类型为select才起效

    buildSelect

    function

    只有当dataUrl设置时此参数才起效,通过一个function来构建下拉框

    dataInit

    function

    初始化时调用,用法:dataInit: function(elem) {do something}通常用在日期的选择上. Example:dataInit : function (elem) {$(elem).datepicker();}

    dataEvents

    array

    事件列表,用法:dataEvents: [{ type: 'click', data: { i: 7 }, fn: function(e) { console.log(e.data.i); }},{ type: 'keypress', fn: function(e) { console.log('keypress'); } }]

    attr

    object

    设置属性值。attr : { title: “Some title” }

    searchhidden

    boolean

    默认情况下,隐藏值不是搜索列。为了使隐藏值可以作为搜索列则将此设为true

    sopt

    array

    此参数只用到单列搜索上,说明搜索条件。可用值:['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc']意 思为['equal','not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain']

    defaultValue

    string

    默认值

    value

    mixed

    只用在搜索类型为select下。可以是string或者object,如果为string则格式为value:label,且以“;”结尾;如果为object格式为editoptions:{value:{1:'One';2:'Two'}}

    · jQuery("#grid_id").jqGrid({  

    · ...  

    ·    colModel: [   

    ·       ...   

    ·       {name:'price', index:'price', 60, search:true, stype:'text', searchoptions:{dataInit:datePick, attr:{title:'Select Date'}} },  

    ·       ...  

    ·    ]  

    · ...  

    · });  

    · datePick = function(elem)  

    · {  

    ·    jQuery(elem).datepicker();  

    · }

    需要说明的: 
    所有的搜索都是使用url来到服务器端查询数据。 
    当执行搜索时会用查询数据填充postData array 
    发送到服务器端搜索字符串的名称为_search 
    当点击刷新按钮时不会使用搜索条件 
    每个搜索方法都有自己的数据清空方法

  • 相关阅读:
    vuex详解
    es6 数组方法的扩展
    es6class语法和继承
    变量的解构赋值
    es6变量let
    前端模块化
    webpack基础
    react中的redux(入门)
    react-router-dom中的BrowserRouter和HashRouter和link与Navlink
    react-router-dom
  • 原文地址:https://www.cnblogs.com/cleverJoe/p/3848842.html
Copyright © 2011-2022 走看看