Posting Data

Author: Paul Tiseo

Module name: grid.postext.js

Description: The main purpose of this module is to manipulate the parameters passed to the to url via an array and to get user-defined data from the response. For user-defined data, please refer to Data Types.

A new option, postData, is added to the option array of the grid. By default this is an empty array. The values of this array are added via $.extend to the ajax request.

Installation: To enable this module you should enable it in jquery.jqGrid.js.

Manipulating parameters

To manipulate the values of the array we can use the following methods:

jQuery("#grid_id").getPostData() returns all parameters passed to the grid url. The returned value is array of type name:value.

jQuery("#grid_id").setPostData( newdata) sets a new set of parameters overriding the existing ones.
newdata should be array of type name:value. Example {myparam:"myvalue"} Note that the page, rowNum, sortorder, sortname parameters are not changed. To change these use setGridParam method.

jQuery("#grid_id").appendPostData( newdata) replaces or appends new parameters to the array. newdata should be array of type name;value

jQuery("#grid_id").setPostDataItem( Key, Val) sets new or replaces the value of the existing item in the array. Key is the name and Val is the value of the item.

jQuery("#grid_id").getPostDataItem( key) returns the value of the requested item with name key

jQuery("#grid_id").removePostDataItem( key) deletes a specified item with name = key from the array.


  Last Updated: 9/4/2008 | © Tony's jqGrid - a jQuery Plugin, 2010