easyui---- 行内编辑、删除
来源:互联网 发布:c语言中制表符怎么用? 编辑:程序博客网 时间:2024/06/05 06:51
效果图:
需要引用脚本:
<link href="~/UILibs/easyui/themes/default/easyui.css" rel="stylesheet" />
<link href="~/UILibs/easyui/themes/icon.css" rel="stylesheet" />
<link href="~/Css/css.css" rel="stylesheet" />
<script src="~/Scripts/jquery-1.7.1.min.js"></script>
<script src="~/UILibs/easyui/jquery.easyui.min.js"></script>
<script src="~/UILibs/easyui/locale/easyui-lang-zh_CN.js"></script>
列表:
<body>
<a class="easyui-linkbutton" iconcls="icon-add" onclick="addRow();">添加</a>
<a class="easyui-linkbutton" iconcls="icon-save" onclick="save();">批量提交</a>
<table id="tb">
</table>
</body>
显示字段内容:
$("#tb").datagrid({ fit: true, title: '行内编辑测试', border: false, striped: true, data: persons, rownumbers: true, columns: [[ { title: '编号', field: 'ID',halign: 'center',align: 'center',width:100, editor: { type: 'validatebox', options: { required: true } } }, { title: '姓名',field: 'Name',halign: 'center',align: 'center',width: 150, editor: { type: 'validatebox', options: { required: true } } }, { title: '年龄',field: 'Age',halign: 'center',align: 'center',width: 100, editor: { type: 'validatebox', options: { required: true } } }, { title: '性别',field: 'Sex',halign: 'center',align: 'center',width: 150, formatter: function (value, row, index) { //格式化性别 for (var i = 0; i < sexs.length; i++) { if (value == sexs[i].id) { return sexs[i].name; } } }, editor: { type: 'combobox', options: { valueField: 'id', textField: 'name', data: sexs, required: true } } }, { title: '操作',field: 'action',halign: 'center',align: 'center',width: 200, formatter: function (value,row,index) { if (row.editing == true) { return "<a href='#' onclick='saveRow(" + index + ");'>确定</a> <a href='#' onclick='reDo(" + index + ");'>取消</a>"; } else { return "<a href='#' style='cursor:pointer' onclick='editRow(" + index + ");'>编辑</a> <a href='#' onclick='deleteRow(" + index + ");'>删除</a>"; } } } ]],
编辑时文本框的格式在editor{type:"",options:""}设置
前台获取的数据(也可以后台调数据):
$(function () {
var persons = [
{ ID: 1, Name: "aaa", Age: 20, Sex: "0" },
{ ID: 2, Name: "bbb", Age: 21, Sex: "1" },
{ ID: 3, Name: "ccc", Age: 22, Sex: "0" },
{ ID: 4, Name: "ddd", Age: 23, Sex: "1" }
];
var sexs = [{ id: 0, name: "男" }, { id: 1, name: "女" }];
添加行:
编辑触发事件(可以参考easyui-api文档datagrid):
编辑、删除、保存:
提交:
UI层Model:
controller:
public ActionResult Save(Persons ps)
{
return null;
}
- easyui---- 行内编辑、删除
- easyui 数据表格行内编辑(编辑、保存、删除)
- EasyUI-Datagrid行内编辑
- Easyui+MVC行内编辑
- easyui datagrid 行编辑功能(行内编辑、删除、保存、取消)
- easyUI的行内编辑editor
- easyui实现datagrid行内编辑
- [转载]easyui datagrid 行内编辑功能
- easyui-datagrid 行内编辑禁止字段可编辑
- easyui datagrid行内编辑时的数据联动
- Easyui datagrid行内【添加】、【编辑】、【上移】、【下移】
- Easyui datagrid行内【添加】、【编辑】、【上移】、【下移】
- Easyui datagrid行内【添加】、【编辑】、【上移】、【下移】
- easyui datagrid实现行内编辑一列数据
- ASP.NET MVC5+EF6+EasyUI 后台管理系统(83)-Easyui Datagrid 行内编辑扩展
- easyui行编辑
- easyui 行编辑
- easyui行编辑2
- spring boot处理请求异常并返回对应的html页面
- 进制转换及ASCII码表查询
- 3103--小鑫爱运动
- NSIS打包out of memory问题解决方法
- 快速入门shell脚本编写(一)
- easyui---- 行内编辑、删除
- Request Headers 里面的 Accept 属性
- java流媒体之rtsp
- Android四种启动模式
- 必看干货 | 学习Vivado如何获取License
- oracle操作字符串:拼接、替换、截取、查找、长度
- 思维导图之探寻墨菲定律
- nrf51822蓝牙芯片ble_app_proximity程序总结
- 编写一个程序,开启3个线程,这3个线程的ID分别为A、B、C,每个线程将自己的ID在屏幕上打印10遍,要求输出结果必须按ABC的顺序显示;如:ABCABC….依次递推。