在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. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  2. "高大上" 名词整理

    大家在和朋友,同行交流时有没有经常遇到各种 "高大上" 的术语,很多词有没有把各位 “鸟哥” 们搞得一头雾水,现在我就把这些 "牛逼" 的东东都罗列一下, 大家 ...

  3. java数组

    1.java是否可以像c一次样搞个不定长数组? 不可以那样写,那样写是非法的.数组构造的时候必须指定长度,因为JVM要知道需要在堆上分配多少空间.也就是要初始化数组的话让JVM知道要给数组分配多少空间 ...

  4. C语言中 指向函数的指针 简介

    引子:在学习CPrimerPlus的第十四章的14.13节中,遇到了如下三行文字,是有关指向函数的指针的,把我搞晕了. char * fump(); //返回指向char的指针的函数 char (* ...

  5. HTMl5的存储方式sessionStorage和localStorage详解

    html5中的Web Storage包括了两种存储方式:sessionStorage和localStorage.sessionStorage用于本地存储一个会话(session)中的数据,这些数据只有 ...

  6. [LeetCode] Construct Binary Tree from Inorder and Postorder Traversal 由中序和后序遍历建立二叉树

    Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume tha ...

  7. 在Unity环境下使用抽象和接口

    http://gamasutra.com/blogs/VictorBarcelo/20131217/207204/Using_abstractions_and_interfaces_with_Unit ...

  8. maven配置和下载

    下载链接:http://maven.apache.org/docs/ 以maven3.0.4为例,eclipse以kepler为例 环境变量的配置 1.系统变量-新建-变量名:MAVEN_HOME-变 ...

  9. 用vue.js学习es6(一):基本工具及配置

    一.工具: sublime,node.js,npm 1.安装sublime 的es6插件: (1).在sublime中按Ctrl+`调出console (2).粘贴以下代码到底部命令行并回车(subl ...

  10. localStorage使用总结

    一.什么是localStorage.sessionStorage 在HTML5中,新加入了一个localStorage特性,这个特性主要是用来作为本地存储来使用的,解决了cookie存储空间不足的问题 ...