<script type="text/javascript">

        $(function () {
$("#dg").datagrid({
url: '',
singleSelect: true,
pagination: true,
pageSize: ,
pageList: [, , , , , , , ],
queryParams: form2Json("searchform"),  //关键之处
//锁定列
frozenColumns: [[{
field: 'ck', checkbox: true
},
]],
columns: [[{
field: "be_id",
title: "专家ID",
hidden: true
}, {
field: "be_name",
title: "专家姓名",
align: 'left',
width:
}, {
field: "be_post",
title: "专家职称",
align: 'left',
width: }, {
field: "dt_id",
title: "所属科室",
align: 'center',
width: ,
formatter: function (value, row) {
return formatterDepartment(value)
}
}, {
field: "be_intro",
title: "专家简介",
align: 'left',
width:
}, {
field: "be_order",
title: "排序ID",
align: 'center',
width:
}]],
})//datagrid $("#submit_search").linkbutton({ iconCls: 'icon-search', plain: true })
.click(function () {
$('#dg').datagrid({ queryParams: form2Json("searchform") }); //点击搜索
}); }) //将表单数据转为json
function form2Json(id) { var arr = $("#" + id).serializeArray()
var jsonStr = ""; jsonStr += '{';
for (var i = ; i < arr.length; i++) {
jsonStr += '"' + arr[i].name + '":"' + arr[i].value + '",'
}
jsonStr = jsonStr.substring(, (jsonStr.length - ));
jsonStr += '}' var json = JSON.parse(jsonStr)
return json
} </script>

HTML

<form name="searchform" method="post" action="" id ="searchform">
<td width="" height=""><strong>专家检索:</strong></td>
<td height="">
<input type="text" name="keyword" size= >
<select name="search_type" id="search_type" >
<option value="-1">请选择搜索类型</option>
<option value="be_name" >按专家姓名</option>
<option value="be_intro">按专家简介</option>
</select>
<select name="search_dept" id="search_dept">
<option value="-1">请选择所属科室</option>
</select>
<a id="submit_search">搜索</a>
</td>
</form>
<table id="dg"></table>

queryParams: form2Json("searchform")  是关键,这个属性是专门用来查询的

  为搜索按钮绑定click事件

$("#submit_search").click(function () {
                $('#dg').datagrid({ queryParams: form2Json("searchform") });   //点击搜索
            });

EasyUI datagrid 多条件查询的更多相关文章

  1. JQuery EasyUI DataGrid根据条件设置表格行样式(背景色)

    1.javascript定义函数返回样式 <script type="text/javascript"> //根据条件设置表格行背景颜色 function setRow ...

  2. 实现easyui datagrid在没有数据时显示相关提示内容

    本示例实现easyui datagrid加载/查询数据时,如果没有相关记录,则在datagrid中显示没有相关记录的提示信息,效果如下图所示 本实例要实现如下图所示的效果: 本示例easyui版本为1 ...

  3. EasyUI ComboGrid的绑定,上下键和回车事件,输入条件查询

    首先我们先看一下前台的绑定事件 1.先定义标签 <input id="cmbXm" type="text" style="width: 100p ...

  4. jquery easyui datagrid翻页后再查询始终从第一页开始

    在查询之前将datagrid的属性pageNumber重新设置为1 var opts = grid.datagrid('options'); opts.pageNumber = 1; easyui d ...

  5. EasyUI datagrid 查询、设置、提交 三

    查询 $(“#grid”).datagrid(“load”,{  a: $('#id').val(),b :$('#text').val() });   {} 里面可以 是序列化参数 $(“#grid ...

  6. 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(8)-MVC与EasyUI DataGrid 分页

    系列目录 前言 为了符合后面更新后的重构系统,文章于2016-11-1日重写 EasyUI Datagrid在加载的时候会提交一些分页的信息到后台,我们需要根据这些信息来进行数据分页再次返回到前台 实 ...

  7. easyui datagrid 分页略解

    easyui datagrid 本身自带了分页功能. 但是这个需要你自己控制. 在后台可以得到两个datagrid的参数,rows 和page.其中rows是每页要显示的个数,page是第几页.单纯的 ...

  8. jquery easyui datagrid使用参考

    jquery easyui datagrid使用参考   创建datagrid 在页面上添加一个div或table标签,然后用jquery获取这个标签,并初始化一个datagrid.代码如下: 页面上 ...

  9. jquery easyui DataGrid

    Easyui Demo网站: http://www.jeasyui.com/  英文 http://www.phptogether.com/juidoc/  中文 datagrip的基本属性方法:ht ...

随机推荐

  1. CentOS 7 安装vsftpd 服务器

    在CentOS7上安装ftp服务器用于保存服务端上传的图片. 1.CentOS卸载vsftpd的方法 如果服务器上已经安装了vsftpd服务,配置出错需要卸载vsftpd服务. 1.1 查找vsftp ...

  2. RNNs

    什么是RNN网络? RNNs背后的主要目的是要使用序列本身的顺序信息.在传统的神经网络里,我们假设输入(输出)是条件独立的.但是,在许多任务里,这是个非常非常差的假设.如果你想预测一个序列中的下一个单 ...

  3. matplotlib绘制柱状图

    参考自Matplotlib Python 画图教程 (莫烦Python)(11)_演讲•公开课_科技_bilibili_哔哩哔哩 https://www.bilibili.com/video/av16 ...

  4. 以About Us为范例在Zen cart中增加页面

    1.在includes\languages\english\html_includes目录中新建文件define_about_us.php 2.在includes\templates\Your_tem ...

  5. XVII Open Cup named after E.V. Pankratiev Stage 14, Grand Prix of Tatarstan, Sunday, April 2, 2017 Problem L. Canonical duel

    题目:Problem L. Canonical duelInput file: standard inputOutput file: standard outputTime limit: 2 seco ...

  6. python中统计计数的几种方法

    以下实例展示了 count() 方法的使用方法: 1 2 3 4 5 6 # !/usr/bin/python3   T = (123, 'Google', 'Runoob', 'Taobao', 1 ...

  7. Spring事务回滚

    配置事物: @Configuration /**强制使用cglib代理时就把proxy-target-class设为true.*/ @EnableTransactionManagement(proxy ...

  8. 【Python】IO编程

    文件读写 StringIO和BytesIO 操作文件和目录 序列化 学习廖老师的py官网的笔记 1.stream的概念.数据交换通常需要建立两根“水管”. 2.同步IO和异步IO.异步性能高,但是编程 ...

  9. Django框架搭建(windows系统)

    Django框架搭建(windows系统) 一.Django简介 开放源代码的Web应用框架,由Python语言编写,一个大而全的框架. 1.web框架介绍 具体介绍Django之前,必须先介绍WEB ...

  10. 你可能不熟悉的JS总结

    暂时性死区 只要块级作用域存在let命令,它所声明的变量就"绑定"这个区域,不再受外部的影响.这么说可能有些抽象,举个例子: var temp = 123; if(true) { ...