开发者

How to send only two column values from jqgrid?

I have a jqgrid and on button click I开发者_StackOverflow社区 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!


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");
    }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜