jqGrid批处理保存-如何在编辑模式下获取所有行数据 [英] jqGrid batch save - how to get all row data in edit mode

查看:250
本文介绍了jqGrid批处理保存-如何在编辑模式下获取所有行数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个jqGrid,其中有100多个行,默认情况下以编辑"模式显示.我试图找出一种在一次调用中将所有行数据发送到服务器的方法.

I have a jqGrid with 100+ rows that are displayed in Edit mode by default. I am trying to figure out a way to send all row data in one call to the server.

问题-如何在编辑模式下获取行数据(getRowData方法返回html)?

The problem - How to get the row data in edit mode (getRowData method returns the html)?

一旦我获得了所有的行数据,我希望可以将它们解析为JSON格式,并通过jQuery.ajax()调用将其发送到服务器.

Once I get all the row data, I can hopefully parse them in a JSON format and send it to the server via jQuery.ajax() call.

在这方面的任何帮助都将不胜感激!

Any help in this regard is greatly appreciated!

推荐答案

我可以想象有很多方法可以实现您的需求.我将向您介绍最简单的一个.它来自

I can imagine me many ways to implement you requirements. I would describe you the simplest one. It consist from

  • 保存所有编辑行.如果您使用内联编辑模式,则需要调用 saveRow 用于所有编辑行.由于saveRow在内部测试编辑中的行是否存在,并且由于大多数行(甚至可能是所有行)已经处于编辑模式,因此您可以使用getDataIDs获取所有行的ID数组,然后在循环返回返回的ID.
  • getRowData的使用(不带参数)或getGridParam的使用以获得"data"选项.
  • 使用 jQuery.ajax 将数据发送到服务器.
  • 最后一步是可选的.您可以开始所有行的编辑模式.
  • saving of all editing rows. If you use inline editing mode then you need call saveRow for all editing rows. Because saveRow tests internally whether the row in editing and because the most rows (probably even all) are already in editing mode, you can just use getDataIDs to get array of ids of all rows and then call saveRow in the loop for every from returned id.
  • usage of getRowData without parameters or usage of getGridParam to get "data" option.
  • send the data to the server using jQuery.ajax.
  • the last step is optional. You can start editing mode for all the rows.

我认为上述方法不仅很容易实现.它大部分都已保存,因为它适用于每个编辑控件(包括自定义控件).

I think that the above approach is not only mostly easy implemented. It's mostly save, because it works for every editing control (inclusive custom one).

这篇关于jqGrid批处理保存-如何在编辑模式下获取所有行数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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