Table of Contents
Upgrade notes in | Documentation menu
Post Data Module
Sometimes there is a need to precisely manipulate the postData array. The setGridParam method does not in some cases do what we want. To do this we can use the Post Data module.
Author
Paul Tiseo
Installation
In order to use this module you should mark the Post methods (in Other modules) when you download the grid. For more information refer to Download.
For Developers - this is the grid.postext.js in the src directory.
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.
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.
- jQuery(“#grid_id”).getUserData returns the userData array.
- jQuery(“#grid_id”).getUserDataItem(key) returns the value of the requested item with name key from userData array