0

I am using jqgrid and want to post data while reloading the grid. I used below code while reloading

  var postData = {page:page,rows:rows,submitFlag:submitFlag,newRowMapData: newRowMapData,existingRowMapData:existingRowMapData};
  $("#grid").jqGrid('setGridParam',{postData:null});
  $("#grid").jqGrid('setGridParam',{postData:postData});
  $("#grid").trigger("reloadGrid"); 

I am sending complete row data in post data. It works fine for two rows. But when I select more than two rows then data is not posted to server and grid dont reload. Is there any case that jqgrid postData can not post large data to server. So please suggest some solution on it.

Man
  • 67
  • 1
  • 11
  • Sorry but I don't understand what exactly you want to do. Typically one don't need ever use `setGridParam` because `getGridParam` returns you **the reference** to internal parameters of the grid and you can just modify the returned object. Resetting `postData` can't modify all data because some values will be set later during processing of `reloadGrid`. Moreover you don't included the code which shows in which form you use jqGrid. The only restriction in the size of posted data exist if you use `mtype: "GET"`: it's the standard restriction of URL length. – Oleg Sep 03 '15 at 15:44
  • @Oleg Thank you very much Oleg for reply. You didnt undrestand the question but still your comment give me hint to solve my problem. Actaully I am working on struts2 jqgrid. Not a conventional one. So not very used it. I set requestType='POST' property in that and now its working. Can you just suggest how I set PostData for grid as you suggested my way is not proper. – Man Sep 04 '15 at 12:31
  • You are welcome! I posted my answer and I would recommend you to read [the answer](http://stackoverflow.com/a/2928819/315935) too. It could be helpful for you. I just not sure where you can easy you the approach in struts2 or not. – Oleg Sep 04 '15 at 14:13

1 Answers1

0

First of all there are no restriction in the size of posted data, but there are exist restriction of URL size if you use mtype: "GET" option (the parameters will be appended to the URL). So you should use mtype: "POST" option if you need to send large parameters in postData.

You can set rowNum parameters of jqGrid (not as properties of postData parameter) and to use page option of reloadGrid (see the answer). In the case the code could be

$("#grid").jqGrid("setGridParam", {
    rowNum: rows,
    postData: {
        submitFlag: submitFlag,
        newRowMapData: newRowMapData,
        existingRowMapData: existingRowMapData
    }
}).trigger("reloadGrid", [{ page: page }]);
Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798