开发者

clear values in jqgrid post parameter array

I'm going to simplify this question.

I have a jqgrid instance which posts an array of ids to the server. I would like the pass in a new list when an event is triggered. Instead of overwriting the old list, jqgrid will add to it. How can i set the post parameters to create a new list each time I reload the grid.

This is the code to reload the grid with new post data

  $('#gridConfirm').jqGrid('setGridParam',{postData:{'deviceIDs':$("#device").val()}});
  $('#gridConfirm').trigger('reloadGrid');

I've confirmed that $("#device").val() returns a list of id's in the form "5,6,7,8"; So i'm expecting this lis开发者_开发百科t to be posted to the server.

Instead, its posting "5,6,7,8" plus the previous list. so if the previous list was "1,2,3,4". It's posting "5,6,7,8,1,2,3,4"

How can i clear the previous posted list when reloading the grid?

*edit* On slight correction, when i change my postdata list. It does not append it overwrites, but it keeps the length of the list.

so if my original list was 1,2,3,4,5 and i selected 6,7 my new list is 6,7,3,4,5

I'm thinking this is a bug in the grid.


Now you removed all code from your question. So I wrote the demo myself which has no problem which you described. You can look at the source and compare with your version to see where you have a problem. In any way I would recommend to use postData having functions as properties (see here).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜