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); $ ...
随机推荐
- 解决编译时出现的警告:format string is not a string literal (potentially insecure)
NSLog([NSString stringWithFormat:@"%@/%@B.jpg", createDir, uuid]);//这是我的写法 应该写成 NSString * ...
- php 10.1总
在做添加时写是否已经有该文件 $_sql1 = "SELECT * FROM tb_user where userName = {$_clean['userName']} "; $ ...
- NSAttributedString 的21种属性 详解
原文链接:http://www.jianshu.com/p/09f54730feaa 先看看所有的Key NSFontAttributeName; //字体,value是UIFont对象 NSPara ...
- 深入理解linux网络技术-P179
上锁 net_device结构的组织一节可知,dev_base列表以及dev_name_head和dev_name_index两张hash表由dev_base_list锁保护.然而,该锁只用于对列表和 ...
- SQL Server 自定义快捷键
SQL Server程序员经常要在SSMS(SQL Server Management Studio)或查询分析器(2000以前)中编写T-SQL代码.以下几个技巧,可以提升工作效率. 以下说明以SS ...
- 17232 伪Acmer的推理(传递闭包)
17232 伪Acmer的推理 时间限制:1000MS 内存限制:65535K提交次数:0 通过次数:0 收入:0 题型: 编程题 语言: G++;GCC Description 现在正是期末, ...
- apache-tomcat-7.0.70无法进入Manager管理App项目
在tomcat文件夹找到conf文件夹中的tomcat-user.xml文件,用记事本打开,在最下面可以看到tomcat默认把用户注释掉了,也就是说打开tomcat主页是进不去管理页面的.方法如下:找 ...
- POJ 1061 青蛙的约会(欧几里得扩展)
题意:已知青蛙1位置x,速度m,青蛙2位置y,速度n,纬线长度为l,求他们相遇时最少跳跃次数. 思路:设最小跳跃次数为k,则(x + k*m) - (y + k*n) = q*l:经过整理得到k*(n ...
- (转)Windows管道(Pipe)重定向stdout,stderr,stdin
参考: http://qiusuoge.com/11496.html http://www.cnblogs.com/BoyXiao/archive/2011/01/01/1923828.html st ...
- AngularJS中的$http.post与jQuery.post的区别
原文:http://my.oschina.net/tommyfok/blog/287748 很多时候我们需要用ajax提交post数据,angularjs与jq类似,也有封装好的post. 但是jQu ...