关于EasyUIDataGrid查询功能

 1 <table id="studentInfo" data-options="toolbar:‘#ft‘" ></table>
 2
 3 $(function () {
 4         $(‘#studentInfo‘).datagrid({
 5             url: ‘/Default/getJson‘,
 6             dataType: ‘json‘,
 7             title: ‘学生信息‘,
 8             width: 700,
 9             idField: ‘id‘,
10             queryParams:{
11                 id: "",
12                 name: "",
13                 sex: "",
14                 age: ""
15             },
16             height: 400,
17             loadMsg: ‘正在加载...‘,
18             striped: true,
19             columns: [[
20                 { field: ‘id‘, title: ‘学号‘ },
21                 { field: ‘name‘, title: ‘姓名‘ },
22                 { field: ‘sex‘, title: ‘性别‘ },
23                 { field: ‘age‘, title: ‘年龄‘ },
24                 { field: ‘dept‘, title: ‘..‘ }
25             ]],
26             singleSelect: false,
27             rownumbers: true,
28             pagination: true,
29             pageList: [10, 15, 20]
30         });
31         var p = $(‘#studentInfo‘).datagrid(‘getPager‘);
32         $(p).pagination({
33             beforePageText: ‘第‘,
34             afterPageText: ‘页    共{pages}页‘,
35             displayMsg: ‘当前显示{from}-{to}条记录  共{total}条记录‘
36         });
37 });

一个查询:

<div id="ft" style="padding:2px 5px;">
    学号:<input id="Id" name="Id" class="textbox" type="text" />
    <a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="obj.search()"></a>
    姓名:<input id="Name" name="Name" class="textbox" type="text" />
    <a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="obj.search()"></a><br />
    性别:<input id="Sex" name="Sex" class="textbox" type="text" />
    <a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="obj.search()"></a>
    年龄:<input id="Age" name="Age" class="textbox" type="text" />
    <a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="obj.search()"></a>
</div>

var obj = {
    search: function () {

        $(‘#studentInfo‘).datagrid(‘load‘, {
            id: $(‘#Id‘).val().trim(),
            name: $(‘#Name‘).val().trim(),
            sex: $(‘#Sex‘).val().trim(),
            age: $(‘#Age‘).val().trim()
        });

    }
};

控制器:

public JsonResult getJson(int page, int rows, string age, string sex, string name, string id)
        {
            var st=db.student.Where(s=>s.id.Contains(id)&&s.name.Contains(name)&&s.sex.Contains(sex)&&SqlFunctions.StringConvert((double)s.age).Contains(age)).ToList();
            return Json(new { total = st.Count, rows = st.Skip((page - 1) * rows).Take(rows) });
        }
时间: 2024-08-11 05:28:36

关于EasyUIDataGrid查询功能的相关文章

python实现whois查询功能的方法源码

恐怕很多朋友跟我一样,使用python语言居然能实现whois服务器查询功能.下面我把代码和说明搬来给大家看看,有谁需要可以参考下.本来想直接从whois服务器查询的,但是发现要写socket 用43端口链接服务器,但是有些服务器的地址不清楚,而且查询命令貌似有改变所以不想折腾了,就想着直接用chinaz的页面实现一下算了.如下代码是在 win7下操作的,安装python3.2测试通过. Python3.2实现whois查询功能的方法源码: # -*- coding:utf-8 -*- impo

[Architecture Pattern] Repository实作查询功能

[Architecture Pattern] Repository实作查询功能 范例下载 范例程序代码:点此下载 问题情景 在系统的BLL与DAL之间,加入Repository Pattern的设计,能够切割BLL与DAL之间的相依性,并且提供系统抽换DAL的能力.但在软件开发的过程中,套用Repository Pattern最容易遇到的问题就是,如何在Repository中实作「查询」这个功能.像是在下列这个查询订单的页面,系统必须要依照用户输入的查询条件,来从DAL中查询出所有符合条件内容的

利用PHP访问数据库——实现分页功能与多条件查询功能

1.实现分页功能 <body><table width="100%" border="1">  <thead>    <tr>      <th>代号</th>      <th>名称</th>      <th>价格</th>    </tr>  </thead>  <tbody>      <?php 

组合查询功能实现

前言 这是我的第二篇文章,这是我之前做的ERP项目的时候设计实现的.在这个ERP系统中,功能比较多,表设计的时候建立了很多业务表.对于一些业务表需要执行很多查询,客户要求针对不同的字段进行查询,基于我们之前的设计,针对不同的查询条件设计不同的DAL方法,通过不同的方法签名来实现客户的对于不同条件查询的要求.但是这种解决方案会让程序员很被动,久而久之整个DAL层会显得很臃肿. 面对这样的困境,考虑是否可以实现用一个通用的DAL方法来代替所有的不同筛选条件查询方法,因为这些查询方法内部的逻辑是一样的

微信公众平台开发(35)(天气预报、股票查询、手机归属查询、在线听音乐、翻译、成绩查询功能)代码分享

微信公众平台开发应用(天气预报.股票查询.手机归属查询.在线听音乐.翻译.成绩查询功能) 原文: http://www.cnblogs.com/imaker/p/5491433.html 1.xml(信息返回用扩展语言XML来传递值) $postStr = $GLOBALS["HTTP_RAW_POST_DATA"]; //extract post data if (!empty($postStr)){ $postObj = simplexml_load_string($postStr

JqueryMobile为Listview动态添加、删除查询功能

JqueryMobile的版本不同,引用JS的API也不同,因此为Listview动态添加.删除查询功能的代码也不同. 假设Listview控件内容如下: <ul data-role="listview" id="listview"  data-inset="true"> <li><a href="#">Acura</a></li> <li><a h

分页和多条件查询功能

/** * 辅助拼接HQL语句的工具类 * @author G-Xia * */ public class QueryHelper { private String fromClause; // From子句 private String whereClause = ""; // Where子句 private String orderByClause = ""; // OrderBy子句 private List<Object> parameters

easyuI企业管理系统-实战六 查询功能

今天你学习了吗?本篇讲述查询功能 class="easyui-searchbox" //easyui自带的查询类 <input class="easyui-searchbox" style="" data-options="prompt:'请输入分类名...',menu:'#mm',searcher:doSearch" plain="true" style="width:300px"

RPM软件包管理的查询功能 转

RPM软件包管理的查询功能: 命令格式 rpm {-q|--query} [select-options] [query-options] RPM的查询功能是极为强大,是极为重要的功能之一:举几个常用的例子,更为详细的具体的,请参考#man rpm 1.对系统中已安装软件的查询: 1)查询系统已安装的软件: 语法:rpm -q 软件名 举例: [[email protected] beinan]# rpm -q gaim gaim-1.3.0-1.fc4 -q就是 --query ,中文意思是“