• 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 
    当点击刷新按钮时不会使用搜索条件 
    每个搜索方法都有自己的数据清空方法

  • 相关阅读:
    redhat 6.4下PXE+Kickstart无人值守安装操作系统
    ubuntu14.04安装好Hadoo之后接着安装hbase和介绍常用命令
    避坑之Hadoop安装伪分布式(Hadoop3.2.0/Ubuntu14.04 64位)
    kindeditor文件上传设置文件说明为上传文件名(JSP版)
    sqlmap 扫描注入漏洞
    局域网内访问不同网段的主机(转记)
    cmd创建用户开启3389命令
    用python来更改windows开机密码
    代码安全之上传文件
    web渗透(转)
  • 原文地址:https://www.cnblogs.com/cleverJoe/p/3848842.html
Copyright © 2020-2023  润新知