在jqgrid中完成编辑 [英] Finalizing editing in jqgrid

查看:182
本文介绍了在jqgrid中完成编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以下列方式使用jqgrid取得了巨大的成功:

I using jqgrid with great succes in the following way:


  1. 数据从服务器加载为JSON

  2. 用户进行内联编辑

  3. 单击保存按钮时,所有数据都使用以下序列进行序列化:

  1. The data is loaded from the server as JSON
  2. The user do inline editing
  3. When a save-button is clicked all the data is serialized using:

var data = $(#mygrid)。getRowData();

var data = $("#mygrid").getRowData();

var datajson = JSON.stringify(data);

var datajson = JSON.stringify(data);

这个方法的问题是,如果用户没有按下返回或离开,我将获取我的json数据中的输入元素编辑过的单元格。有没有办法结束编辑模式我jqgrid?

The problem with this aproach is that I will get the input elements in my json-data if the user has not pressed return or moved away from the edited cell. Is there any way to end edit mode i jqgrid?

推荐答案

你可以使用 saveRow 保存数据。

To使用 saveRow 你必须知道的行ID当前可编辑的行。例如,您可以将当前编辑的rowid保存在变量中(在调用 editRow )并使用该值来调用 saveRow 方法。

To use saveRow you have to know the row id of the current editable row. You can for example save the rowid of the current editing in a variable (before you call editRow) and use the value for calling of the saveRow method.

更新:请参阅演示。首先选择一些行,修改值,然后单击保存当前编辑行按钮。您将看到更改将被保存。

UPDATED: see the demo. First select some row, modify the values and then click on the "Save current editing row" button. You will see that the changes will be saves.

这篇关于在jqgrid中完成编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆