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); $ ...
随机推荐
- [转]View属性 之 paddingStart & paddingEnd
[CAUSE] 在写一个自定义View时, 直接复制了Android-Source的XML布局文件, 默认开发SDK版本是4.2.2(Level-API-17), 后因其他原因将SDK版本改为4.1. ...
- hdu 1180诡异的楼梯(bfs)
诡异的楼梯 Time Limit : 2000/1000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other) Total Submis ...
- 单独谈谈 Android Cursor 的使用细节
使用过 SQLite 数据库对 Cursor 应该不陌生,这里单独拿出来谈一下,加深对Android SQLite中使用 Cursor 的理解. 在你理解和使用 Android Cursor 的时候你 ...
- 二叉树,平衡树,红黑树,B~/B+树汇总
二叉查找树(BST),平衡二叉查找树(AVL),红黑树(RBT),B~/B+树(B-tree).这四种树都具备下面几个优势: (1) 都是动态结构.在删除,插入操作的时候,都不需要彻底重建原始的索引树 ...
- 用memcached的时候找key找不到,写了个命令来找找
for i in $(seq 30); do echo "stats cachedump $i 0" | nc 192.168.88.150 11211 | grep groupS ...
- struts2 里escape="false"的问题?
<s:property value="html" escape="false"/> 没有name 不知道你是怎么取的值 <s:hidden n ...
- 救援行动(save)
救援行动(save) 题目描述 Angel被人抓住关在一个迷宫了!迷宫的长.宽均不超过200,迷宫中有不可以越过的墙以及监狱的看守.Angel的朋友带了一个救援队来到了迷宫中.他们的任务是:接近Ang ...
- Blocks(闭包)
转自:http://my.oschina.net/joanfen/blog/317644?fromerr=ATWzC3Y2 Block 与传统代码相比较更加轻量,调用简洁方便,而且可以返回多个参数,使 ...
- 常用Select语句
--语 句 功 能--数据操作SELECT --从数据库表中检索数据行和列INSERT --向数据库表添加新数据行DE ...
- Qt5:窗口居中显示
QDesktopWidget* desktop = QApplication::desktop(); // =qApp->desktop();也可以move((desktop->width ...