How to send only specific column values from jqgrid? -
i have jqrid multiple columns , rows loaded via json. on click of update button sending grid data server json below.
$("#updatetradedetail").click(function () { var griddata = $("#tradedetailgrid").jqgrid('getgridparam', 'data'); $.ajax({ url : "${pagecontext.request.contextpath}" + "/xxxxxx/tools/updatetrades", type : "post", data: json.stringify(griddata), datatype: 'html', contenttype: "application/json; charset=utf-8", success : function(msg) { alert("response on update " + msg); }, error: function (xhr, ajaxoptions, thrownerror) { alert(xhr.status); alert("error" + thrownerror); } }); });
how send specific column values has multiple rows server?
if need send data only 1 column getcol
alternative getgridparam("data")
. second parameter of getcol
defines format of returned data. 1 should careful in usage of getcol
because uses unformatter data grid cells (from <td>
elements) , data returned getcol
, getgridparam("data")
can little different.
one more remark. usage of getgridparam("data")
not data if don't have column in grid contains rowid (for example column having key: true
property in colmodel
). full data 1 need getgridparam("data")
, getgridparam("_index")
. see the answer, this one, this one , many other.
probably safe , simple way do need making copy of array returned getgridparam("data")
, modifying removing unneeded properties. want stress importance of making copies because getgridparam("data")
returns the reference array internal data used jqgrid. if makes changes in changes applyed on grid on next refresh (on sorting, paging , on).
Comments
Post a Comment