`
a3mao
  • 浏览: 559128 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

jqGrid学习 --------------自定义搜索

    博客分类:
  • Work
阅读更多
定义自己的查询
<div id="mysearch"></div>

JS中使用
jQuery("#mysearch").filterGrid('#grid_id',options);

grid_id:表格id
options:参数
参数描述默认值
gridModel当为ture我们会使用colModel中的属性构造查询条件,所用到的参数:name, index, edittype, editoptions, search.还有一个参数:defval:查询条件的默认值;surl:当edittype:'select'时获取select数据的url,格式:<select><option value='val1'> Value1 </option><option value='val2'> Value2 </option>…<option value='valn'> ValueN </option></select> false
gridNamesgridModel为true时起效,设置查询列的名称false
filterModelgridModel为false时起效,格式:{label:'LableFild', name: 'colname', stype: 'select', defval: 'default_value', surl: 'someurl', sopt:{optins for the select}}。label:字段显示名称;name:列名;stype:输入框类型,text或者select;surl:获取select数据的地址,要求的内容为html格式:<select><option value='val1'> Value1 </option><option value='val2'> Value2 </option>…<option value='valn'> ValueN </option></select>;sopt:同editoptions  []
formtype定义表单如何被构造,'horizontal' or 'vertical'horizontal
autosearch如果为true:当点击回车键触发查询;当select值变化时触发查询true
formclass可以使用的cssfilterform
tableclass可以使用到table上的cssfiltertable
buttonclass按钮上使用的cssfilterbutton
searchButton搜索按钮Search
clearButton清空数据的按钮Clear
enableSearch启用禁用搜索按钮false
enableClear启用禁用清空按钮false
beforeSearch搜索之前触发的事件null
afterSearch搜索完成之后触发的事件null
beforeClear清空数据之前触发的事件null
afterClear清空数据之后触发事件null
url搜索数据的url‘’
marksearched当为true时,每次查询之后所有查询的列都标记为可查询列true


查询用到的方法:
var sg = jQuery("#mysearch").filterGrid(...)[0]; 
sg.triggerSearch();

sg.clearSearch();
分享到:
评论
2 楼 aa466564931 2012-09-15  
来自:
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:custom_searching

“Do not use these methods with the new API. They will not work! ”
1 楼 aa466564931 2012-09-15  
这个方法已经被废弃掉了 所以没有用了

相关推荐

Global site tag (gtag.js) - Google Analytics