如何从 jqgrid 只发送两列值?

发布于 2024-09-25 15:00:50 字数 82 浏览 8 评论 0原文

我有一个 jqgrid,单击按钮时我只想发送两列值而不是发送整个值...我如何实现是使用 getRowData ....任何建议将不胜感激.. 谢谢!

I have a jqgrid and on button click I just want to send two column values instead of sending the whole values...how can I achieve is using getRowData ....any suggestion will be appreciated..
Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

远昼 2024-10-02 15:00:50

可能方法 getCol 可以让你停下来。如果您要发送的列中的一列是带有 id (key:true) 的列,那么您可以通过一次调用接收所需的数据:

var myData = $('#list').jqGrid('getCol', 'column Name 1', true);

如果没有来自columns 在列定义中有 key:true 您应该进行两次调用:

var myData1 = $('#list').jqGrid('getCol', 'column Name 1');
var myData2 = $('#list').jqGrid('getCol', 'column Name 2');

然后您可以合并数据或将其单独设置为两个参数:

$.ajax({
    type: "POST",
    url: "/cpsb/internalOrderList.do",
    data : {
        jgGridData1: JSON.stringify(myData1),
        jgGridData2: JSON.stringify(myData2)
    },
    dataType:"json",
    contentType: "application/json; charset=utf-8",
    success: function(response, textStatus, xhr) {
        alert("success");
    },
    error: function(xhr, textStatus, errorThrown) {
        alert("error");
    }
});

Probably the method getCol can halt you mostly. If one from the columns which you want to send is the column with id (key:true) then you can receive data which you need with one call:

var myData = $('#list').jqGrid('getCol', 'column Name 1', true);

If no from the columns has key:true in the column definition you should make two calls:

var myData1 = $('#list').jqGrid('getCol', 'column Name 1');
var myData2 = $('#list').jqGrid('getCol', 'column Name 2');

Then you can combine the data or set there separate as two parameters:

$.ajax({
    type: "POST",
    url: "/cpsb/internalOrderList.do",
    data : {
        jgGridData1: JSON.stringify(myData1),
        jgGridData2: JSON.stringify(myData2)
    },
    dataType:"json",
    contentType: "application/json; charset=utf-8",
    success: function(response, textStatus, xhr) {
        alert("success");
    },
    error: function(xhr, textStatus, errorThrown) {
        alert("error");
    }
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文