jqGrid的搜索框下拉
当需要在jqGrid的搜索框里配置搜索条件时,如下拉,日期等,代码如下:
datePick = function(elem)
{
jQuery(elem).datepicker();
}
colNames : [ "OP_ID", "OP_Module", "OP_Type", "OP_Content", "Operator", "OperatorType", "OP_Time", "OP_IP"],
colModel : [{name:'op_id', index:'op_id', width:100, align:'center', editable:false, search:false},
{name:'op_module', index:'op_module', width:110, align:'center', search:true, editable:false,
stype:'select', searchoptions: {dataUrl:'./select/module', sopt:['eq', 'ne']}},
{name:'op_type', index:'op_type', width:100, align:'center', search:true, editable:false,
stype:'select', searchoptions: {dataUrl:'./select/type', sopt:['eq', 'ne']}},
{name:'op_content', index:'op_content', width:250, align:'center', editable:false, sortable:false,
stype:'text', searchoptions: {sopt:['bw', 'bn', 'ew', 'en','cn', 'nc']}},
{name:'op_by', index:'op_by', width:100, align:'center', search:true, editable:false},
{name:'operator_type', index:'operator_type', width:130, search:true, align:'center', editable:false,
stype:'select', searchoptions: {dataUrl:'./select/operator_type', sopt:['eq', 'ne']}},
{name:'op_at', index:'op_at', width:170, align:'center', search:true, editable:false,
stype:'text', searchoptions: {dataInit:datePick, attr:{title:'Select Date'}, sopt:['cn', 'nc', 'in', 'ni']}, formatter:'date', formatoptions:{srcformat: 'Y-m-d H:i:s', newformat: 'm/d/Y H:i:s'}},
{name:'op_ip', index:'op_ip', width:100, align:'center', search:true, editable:false}
],
其中,colModel的属性的stype有“text”和“select”两种,需要下拉选项时,则选择“select”;同时,searchoptions也进行设置,dataUrl为请求路由,路由返回的数据是
<select><option>1</option></select>的格式;重要的是需设定:ajaxSelectOptions: {type: "GET"} ,其中type可以是Post,这样你的搜索才能返回数据。
jQuery(grid_selector).jqGrid({
url : "./show_log",
datatype : "json",
mtype : "post",
height : 370,
width : 1150,
ajaxSelectOptions : {type: "GET"} ,
而想显示日期选择框时,stype设定为“type”,searchoptions: {dataInit:datePick, attr:{title:'Select Date'}, sopt:['cn', 'nc', 'in', 'ni']},
formatter:'date', formatoptions:{srcformat: 'Y-m-d H:i:s', newformat: 'm/d/Y H:i:s'}}。其中,formatoptions可以自己设置需要的格式。
搜索框搜索时会向后台传递数据,字段为:filters,是一个数组,每个搜索条件对应着三个内容:'field','op',’data‘,如下:
{field:'field2', op:'ne', data:'keyword2'}
jqGrid的搜索框下拉的更多相关文章
- Ajax跨域:Jsonp实例--百度搜索框下拉提示
Ajax跨域:Jsonp实例--百度搜索框下拉提示 一.总结 一句话总结:a.找好接口:b.用script标签的src引入文件(json数据):c.定义及实现上一步引入文件中的函数 1.如何找到一个网 ...
- typecho博客组插件:openSug.js百度搜索框下拉提示免费代码
Typecho候选搜索增强插件:安装openSug插件即可获得带有“搜索框提示”功能的搜索框,让Typecho搜索更便捷! 支持百度.谷歌.雅虎.Yandex.360好搜.UC神马.酷狗.优酷.淘 ...
- C#用HttpClient抓取jd.com搜索框下拉数据
添加System.Web.dll引用 添加System.Net.Http引用 using System.Net.Http; using System.Web; string key = "电 ...
- 自定义SWT控件三之搜索功能下拉框
3.搜索功能下拉弹出框 package com.view.control.select; import java.util.ArrayList; import java.util.LinkedList ...
- easyui的combobox,自动搜索的下拉框
作者:多来哈米 如图,输入关键字,左匹配检索 HTML代码 <input class="easyui-combobox" name="userId" id ...
- UI自动化之特殊处理二(弹框\下拉框\选项\文件上传)
弹框\下拉框\选项\文件上传也是一些比较特殊的操作 目录 1.弹框 2.下拉框 3.选项 4.文件上传 1.弹框 弹框有三种形式,value为alert.confirm.prompt三种的弹框,第一个 ...
- JavaScript---网络编程(11)--DHTML技术演示(4)-单选框/下拉菜单/添加文件
本节讲述单选框/下拉菜单/添加文件,综合css,html和JavaScript. 单选框: 实现的功能是:(类似平时的性格测试) 先隐藏一部分页面,然后通过点击单选框来显示. 再通过选项的选择-(每个 ...
- ComboBox 自动调整组合框下拉部分的宽度
/// <summary> /// ComboBox 自动调整组合框下拉部分的宽度 /// </summary> void Resiz ...
- kendo 级联加带搜索的下拉框以及js赋值
1‘.js给下拉框赋值 $("#UserRole").data("kendoDropDownList").value(dataItem.RoleName); $ ...
随机推荐
- Struts中的数据处理的三种方式
Struts中的数据处理的三种方式: public class DataAction extends ActionSupport{ @Override public String execute() ...
- POJ 2182/暴力/BIT/线段树
POJ 2182 暴力 /* 题意: 一个带有权值[1,n]的序列,给出每个数的前面比该数小的数的个数,当然比一个数前面比第一个数小的个数是0,省略不写,求真正的序列.(拗口) 首先想到的是从前到后暴 ...
- ios 概况了解
iOS的系统架构分为四个层次:( iOS是基于UNIX内核,android是基于Linux内核) 核心操作系统层(Core OS layer).核心服务层(Core Services layer).媒 ...
- linux中服务器定时程序设定
服务器不重启的情况下定时自动重启apache及mysql服务,其实也大同小异.具体步骤如下: 一.每天的12点及16点重启apache及mysql服务 [root@www bin]# cd /opt ...
- elasticsearch 管理工具
------------------sense------------------- google chrome 浏览器插件,数据交互使用 -------------------------hea ...
- 关于Context []startup failed due to previous errors有效解决方式
http://blog.csdn.net/mcpang/article/details/5468386
- ASP.NET中的Response
Response.BufferOutput=true.false 是否设置缓存 Response.Write("") 输出字符串 Response.IsClientConne ...
- call_create_syn.sql
promptprompt ================================================================================prompt ...
- Android Fragment 真正的完全解析(上)--转
转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/37970961 自从Fragment出现,曾经有段时间,感觉大家谈什么都能跟Fra ...
- HDU 1074 Doing Homework(状态压缩)
之前做过一个题,是在学贪心的时候做的,所以这个题就想当然的跑偏了,当看到N是<=16 的时候,状态压缩就理所当然了 #include<iostream> #include<cs ...