在datagrid中如何实现让一行进入编辑状态,修改数据后,保存信息呢?

     //点击列表变成文本框,进入可编辑状态

     $(function () {
var doc = $(document),
table = $("#divReportTable");
doc.on("mousedown", ".btnEdit", function () { var th = $(this),
ind = th.attr("index"),
keyid = th.attr("keyid"); type = th.attr("type");
if (th.hasClass("btnEdit")) {
if (type == "edit") { table.datagrid("beginEdit", ind);
setTimeout(function () {
th.html("保存")
.attr("type", "sava");
var _ele = table.datagrid('getEditors', ind); })
} else if (type == "sava") {
var ele = table.datagrid('getEditors', ind); table.datagrid("endEdit", ind);//结束编辑 @*//执行保存的操作
$.ajax({
url: '@Url.Action("ActionName", "ControllerName")',
data: { "ID": keyid, "Score": Score },
type: "POST",
async: true,
dataType: "json",
success: function (result) {
if (result.Success == true) {
RefreshData()
} else {
//alert('失败');
}
}
});*@
}
}
}) doc.on("mousedown", ".datagrid-editable-input", function () {
//alert('点击了文本框');
console.log(this);
//PersonSelect('11', '11txt'); var user = $(this).val();
$(this).val(user.UserName); }); })
col.push({
title: "操作", field: "Operate", width: 120, align: "center", resizeable: false, formatter: function (value, row, index) {
return "<a href=\"javascript:void(0)\" class='btnEdit' index='" + index + "' keyid='" + row.ID + "' type='edit'>编辑</a>"
}
});
colOne.push({
title: "填报人", field: "FillUser", width: 135, align: "center", resizeable: false, rowspan: rows, formatter: function (value, row) {
return WorkModel.FormateUser(row.FillUser, row.FillUserName, 1, row.ID, fromType);
},
editor: { type: "text" }
});

给列加上editor:{type:"text"} 进入编辑状态后,编辑状态下,这一列将显示成文本框. type:字符串,编辑类型,可选值:text,textarea,checkbox,numberbox,validatebox,datebox,combobox,combotree。

Easyui 设置datagrid 进入编辑状态,保存结束编辑的更多相关文章

  1. 学习日记6、easyui datagrid 新增一行,编辑行,结束编辑和删除行操作记录

    1.新增一行并进入编辑状态 var index=$('#Numbers').datagrid('appendRow', { CardInformation: '开户行', CardNumber: '银 ...

  2. easyui的datagrid用js插入数据等编辑功能的实现

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  3. easyui,datagrid表格,行内可编辑

    最近用到easyui,需要表格内编辑,但是我同一个页面有多个表格,把官方的代码修改了一下,如下: HTML代码 <table id="dg" class="easy ...

  4. odoo14 编辑状态和非编辑状态下隐藏

    1 <div class="oe_edit_only"> 2 <a name="remove_group_id" type="obj ...

  5. easyUI的datagrid控件日期列不能正确显示Json格式数据的解决方案

    EasyUI是一套比较轻巧易用的Jquery控件,在使用过程中遇到一个问题,它的列表控件——datagrid, 在显示日期列的时候,由于后台返回给页面的数据是Json格式的,其中的日期字段,在后台是正 ...

  6. easyUI的datagrid控件日期列格式化

    转自:https://blog.csdn.net/idoiknow/article/details/8136093 EasyUI是一套比较轻巧易用的Jquery控件,在使用过程中遇到一个问题,它的列表 ...

  7. EasyUI的datagrid获取所有正在编辑状态的行的行编号

    今天项目需要用了下EasyUI的datagrid的行编辑功能,跟着API来,只要是将各种状态时的处理逻辑弄好,还是蛮不错的. 开发过程中,遇到了个问题,在编辑完成后我需要获取datagrid所有处于编 ...

  8. easyui分页,编辑datagrid某条数据保存以后跳转到某一页

    参考资料:http://caizhilin2010.iteye.com/blog/1731698 问题:商品列表页面采用easyui的datagrid展示数据,编辑某行数据保存以后,要求跳转到 用户在 ...

  9. 使用EasyUI的Datagrid的Editor进行行编辑,Enter回车结束编辑,并开启新的一行。

    //新增数据function add() { if (Index == undefined) { row = { move_date: '', start_time: '', end_time: '' ...

随机推荐

  1. freeswitch 使用mysql替换默认的sqlite

    转自 80000hz.com freeswitch 使用mysql替换默认的sqlite No Reply , Posted in 默认分类 on January 14, 2014 目标使用mysql ...

  2. Android LayoutInflater.inflate(int resource, ViewGroup root, boolean attachToRoot)的参数理解

    方法inflate(int resource, ViewGroup root, boolean attachToRoot) 中 第一个参数传入布局的资源ID,生成fragment视图,第二个参数是视图 ...

  3. MyBatis源码分析-SQL语句执行的完整流程

    MyBatis 是支持定制化 SQL.存储过程以及高级映射的优秀的持久层框架.MyBatis 避免了几乎所有的 JDBC 代码和手动设置参数以及获取结果集.MyBatis 可以对配置和原生Map使用简 ...

  4. IOS错误Could not produce class with ID

    运行环境 Unity 5.3.5f1 (IL2CPP)编译IOS版本 XCode Version 7.2.1 (7C1002) Mac OS X 10.11.3 (15D21) (Mac mini) ...

  5. OnDraw函数

    本文仅用于学习交流,商业用途请支持正版!转载请注明:http://www.cnblogs.com/mxbs/p/6219428.html 方法一.对字符串直接赋值 在View类中定义了OnDraw函数 ...

  6. h5+mui

    参考链接http://blog.csdn.net/tbwood/article/details/42081861 待补充

  7. codevs 2879 堆的判断

    codevs 2879 堆的判断 http://codevs.cn/problem/2879/ 题目描述 Description 堆是一种常用的数据结构.二叉堆是一个特殊的二叉树,他的父亲节点比两个儿 ...

  8. JavaScript模板引擎artTemplate.js——template.helper()方法

    上一篇文章我们已经讲到了helper()方法,但是上面的例子只是一个参数的写法,如果是多个参数,写法就另有区别了. <div id="user_info"></d ...

  9. 1.ios synthesize有什么作用

    ###1.ios synthesize有什么作用 当定义了一系列的变量时,需要写很多的getter和setter方法,而且它们的形式都是差不多的,所以Xcode提供了@property和@synthe ...

  10. 无限制使用ppt转pdf功能

    https://smallpdf.com/cn是一个pdf处理网站,十分好用,可是非注册用户有很多限制,比如用两次ppt转pdf就要等待: 于是就想如何让服务器认为我没有用过这个功能呢,感觉应该是用c ...