This is an old revision of the document!
Methods
jqPivot
jqPivotGrid has the following calling convention
jQuery("#grid").jqGrid('jqPivot', data, pivotoptions, gridoptions, ajaxoptions);
Where
#grid is the id of the table element as used in the jqGrid.
data
- can be a string or array of data to be passed to the pivot. In case the parameter is a string a ajax request is made. The data that should be returned should have a name value pair like this:
{"rows":[ {"CategoryName":"Beverages","ProductName":"Steeleye Stout","Country":"UK","Price":"1008.0000","Quantity":"65"}, {"CategoryName":"Beverages","ProductName":"Laughing Lumberjack Lager","Country":"USA","Price":"140.0000","Quantity":"10"}, {"CategoryName":"Beverages","ProductName":"Lakkalik","Country":"USA","Price":"2160.0000","Quantity":"120"}, ... ]}
The “rows” property name can be configured from the ajaxoptions - see below.
In case a array of data is passed the rows property should be omitted and the data should look like this
[ ... {"CategoryName":"Beverages","ProductName":"Steeleye Stout","Country":"UK","Price":"1008.0000","Quantity":"65"}, {"CategoryName":"Beverages","ProductName":"Laughing Lumberjack Lager","Country":"USA","Price":"140.0000","Quantity":"10"}, {"CategoryName":"Beverages","ProductName":"Lakkalik","Country":"USA","Price":"2160.0000","Quantity":"120"}, ... ]
The method expect all the needed data to be passed to the pivot. This means that no other special handling on server
should be done. All other next transformations are done at client side and the jqPivotGrid build its new data to be displayed.
pivotoptions
This is a object with following properties:
Property | Type | Description | Default |
---|---|---|---|
align | string | Default align for the resulting columns | right |
aggregates | array of objects | Defines the aggregates records and builds the pivot. The array should have at minimum one set of object and should be always be defined. If no aggregates is set, the pivot will not be builded. For all available properties see below | Non empty |
formatter | mixed | The default formatter used for the resulting column. Later this will be added in aggregates | number |