使用B-JUI 1.31版本

DataGrid 页直接上代码:

<div class="bjui-pageHeader" style="background-color: #fefefe; border-bottom: none;">
<form data-toggle="ajaxsearch" id="findglobalform" data-options="{searchDatagrid:$.CurrentNavtab.find('#datagrid-globals')}">
<fieldset>
<legend style="font-weight:normal;">搜索:</legend>
<div style="margin:0; padding:1px 5px 5px;">
<span>姓名全拼:</span>
<input name="pinyin" size="10">&nbsp;
<span>性别:</span>
<select name="sex">
<option value="">全部</option>
<option value="M">男</option>
<option value="F">女</option>
</select>&nbsp;
<span>生日:</span>
<input name="birth" type="text" value="" data-toggle="datepicker" placeholder="点击选择日期" data-pattern="yyyy-MM-dd" readonly="true">&nbsp;
<span>身份证:</span>
<input name="idcard" size="20"> <div class="btn-group">
<button type="submit" class="btn-green" data-icon="search">查询!</button>
<button type="reset" class="btn-orange" data-icon="times">重置</button>
</div>
</div>
</fieldset>
</form>
</div>
<div class="bjui-pageContent">
<table class="table table-bordered" id="datagrid-globals" data-toggle="datagrid" data-options="{
loadType:'GET',
filterThead:false,
columnFilter:false,
columnMenu:false,
showCheckboxcol:false,
height: '98%',
width:'100%',
gridTitle : '全局ID列表',
showToolbar: true,
toolbarCustom: globallistbar,
dataUrl: 'service/global/list',
dataType: 'json',
editMode: {dialog:{width:'500',height:300,title:'编辑人员信息',mask:true,fresh:true,beforeClose:'closeeditglobal'}},
editUrl: 'html/pixconf/editglobal.html',
delUrl:'service/global/delete',
delPK:'globalid',
paging: {pageSize:2,selectPageSize:'15,30'},
linenumberAll: true }">
<thead>
<tr>
<th data-options="{name:'globalid',align:'center',width:20,quicksort:false}">ID</th>
<th data-options="{name:'name',align:'center',width:70,quicksort:false}">姓名</th>
<th data-options="{name:'sex',render:'renderSexType',align:'center',width:40}">性别</th>
<th data-options="{name:'birth',align:'center',width:120,quicksort:false}">生日</th>
<th data-options="{name:'mobile',align:'center',width:140,quicksort:false}">手机号</th>
<th data-options="{name:'idcard',align:'center',width:170,quicksort:false}">身份证</th>
<th data-options="{name:'medcard',align:'center',width:170,quicksort:false}">社保号</th>
<th data-options="{render:'global_operation',align:'center',quicksort:false}">操作</th>
</tr>
</thead>
</table>
</div>
<script type="text/javascript">
function closeeditglobal() { $.CurrentNavtab.find('#datagrid-globals').datagrid('refresh');
return true;
} function renderSexType(value) {
return (value == 'F') ? '女' : '男';
} function newGlobal() {
BJUI.dialog({
id: 'newglobaldlg',
url: 'html/pixconf/addglobal.html',
title: '新增人员',
mask: true,
height: 400,
width: 500,
});
} function globallistbar() {
return '<button type="button" class="btn-blue" data-icon="plus" onclick="newGlobal()">新增</button>';
}
// 操作列
function global_operation() {
var html = '<button type="button" class="btn-green" data-toggle="edit.datagrid.tr">编辑</button>' + '<button type="button" class="btn-red" data-toggle="del.datagrid.tr">删除</button>' return html
}
</script>

效果如图:

分页

后台必须接收的参数为:pageCurrent,pageSize

后台返回的数据格式为:{"totalRow":1,"list":[{"globalid":3,"address":"","birth":"2017-01-08","idcard":"130828198711120030","medcard":"1122334455667788","mobile":"13399998888","name":"王五","sex":"F","pinyin":"wangwu"}],"status":0}

B-JUI 实践 之 带搜索与编辑的Datagrid的更多相关文章

  1. 带搜索的ComboBox

    带搜索的ComboBox就是给ComboBox一个依赖属性的ItemSource,然后通过数据源中是否包含要查询的值,重新给ComboBox绑定数据源. public class EditComboB ...

  2. Easy UI combobox实现类似 Select2的效果,下拉带搜索框

    一直在开发一个新系统,其中用Easy UI作为前端框架,少不了用 combobox做为一个 下拉控件,它支持 可编辑 模糊本地数据过滤,也可支持 不可编辑 下拉 选择的功能: $('#ID' ).co ...

  3. YII关联字段并带搜索排序功能

    1.简介 从接触yii框架到现在已经快有两个月了,但是自己对yii框架的了解程度并不是很深,并没有系统地去学习,仅仅只是在做项目的时候遇到不懂得知识才去翻手册. 在上一个项目中因为需要将关联的表的字段 ...

  4. Android UI(五)云通讯录项目之联系人列表,带侧滑选择,带搜索框

    作者:泥沙砖瓦浆木匠网站:http://blog.csdn.net/jeffli1993个人签名:打算起手不凡写出鸿篇巨作的人,往往坚持不了完成第一章节.交流QQ群:[编程之美 365234583]h ...

  5. 带搜索框的jQuery下拉框插件

    由于下拉框的条数有几十个,于是打算找一个可以搜索查找功能的下拉框,刚开始在网上看了几个,都是有浏览器兼容性问题,后来看到这个“带搜索框的jQuery下拉框美化插件 searchable”,看演示代码简 ...

  6. jqgrid 使用自带的行编辑

    上篇jqgrid 单击行启用行编辑,切换行保存原编辑行 本篇,说说使用jqgrid自带的行编辑 1)设置需要编辑的列  editable: true colModel: [ { label: '字段编 ...

  7. 多选下拉框带搜索(aps.net)

    自己写了一个带搜索功能的多选下拉框,为了要获取值,就没有封装插件,实现思路 1.一个文本框 做搜索 2.一个文本框显示选中文本,一个隐藏控件存值 3.一个div里面绑定CheckBoxList控件(这 ...

  8. 【Select2】带搜索框的下拉框美化插件

    1  引入js css 文件 <script src="js/jquery-1.11.1.min.js"></script> <script src= ...

  9. select2 下拉搜索 可编辑可搜索 / 只可搜索

    官网 (http://select2.github.io/examples.html) <!--引入select2需要的文件--> <script type="text/j ...

随机推荐

  1. HDU1425 <sort 快排>

    给你n个整数,请按从大到小的顺序输出其中前m大的数. 每组测试数据有两行,第一行有两个数n,m(0<n,m<1000000),第二行包含n个各不相同,且都处于区间[-500000,5000 ...

  2. 转:web_submit_data函数

    web_submit_data函数处理无状态或者上下文无关的表单提交.它用来生成表单的GET或POST请求,这些请求与Form自动生成的请求是一样的.发送这些请求时不需要表单上下文. 函数语法:Int ...

  3. PAT (Advanced Level) 1057. Stack (30)

    树状数组+二分. #include<iostream> #include<cstring> #include<cmath> #include<algorith ...

  4. c# dev控件 gridcontrol 数据跟随鼠标滚轮滚动也可以编辑

    在绑定书到gridControl后经常发现: 如果你设置了 this.gridView3.OptionsBehavior.Editable = false; 那数据可以跟随滚轮滚动,但如果你要复制某个 ...

  5. HDU 5166 Missing number 简单数论

    Missing number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) [ ...

  6. 关于go的不爽

    这里想记录下,自己学习.使用go语言,对于go语言不爽的地方. 1. 函数返回类型接在参数类型后面,不容易一眼看清楚函数的返回类型 如下,是不是有种很花的感觉. func NewReader(s st ...

  7. linux自动启动程序

    下面用自启动apache为例: 有两种方法可以让Apache在系统启动时自动启动   1. 在/etc/rc.d/rc.local中增加启动apache的命令,例如:/usr/local/httpd/ ...

  8. openstack controller ha测试环境搭建记录(十四)——配置cinder(存储节点)

    先简述cinder存储节点的配置:  1.IP地址是10.0.0.41:  2.主机名被设置为block1:  3.所有节点的hosts文件已添加相应条目:  4.已经配置了ntp时间同步:  5.已 ...

  9. C# 6.0 11个新特性

    1. 静态using(static using) 静态using声明允许不使用类名直接调用静态方法. The static using declaration allows invoking stat ...

  10. Protocol Buffers

    今天来介绍一下"Protocol Buffers"(以下简称protobuf)这个玩意儿.本来俺在构思"生产者/消费者模式"系列的下一个帖子:关于生产者和消费者 ...