Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
wiki:retrieving_data [2011/11/27 20:43] olegk Fixed {} to [] in array encoding in JSON data |
wiki:retrieving_data [2012/09/18 15:26] (current) kompi added a method to specify lastpage in case of a function datatype |
||
---|---|---|---|
Line 109: | Line 109: | ||
}); | }); | ||
</code> | </code> | ||
+ | |||
+ | <note important>As of version 4.3 jqGrid can read any attribute from the XML response. Moreover the tags can be set as function.</note> | ||
+ | |||
All the elements in the XML reader will be explained as examples rather than as strong description. | All the elements in the XML reader will be explained as examples rather than as strong description. | ||
Line 448: | Line 451: | ||
==== XML Notes and Limitations ==== | ==== XML Notes and Limitations ==== | ||
- | * Attributes in any XML tag can not be used to obtain the data. The only exception is the id | + | * <del>Attributes in any XML tag can not be used to obtain the data. The only exception is the id</del> |
* When the option repeatitems in xmlReader is set to true the number of columns defined in ColModel should be equal of the number of cells in the row element | * When the option repeatitems in xmlReader is set to true the number of columns defined in ColModel should be equal of the number of cells in the row element | ||
* When the option repeatitems in xmlReader is set to true the id of the row can be set using the [[:wiki:colmodel_options |key option ]] in colModel | * When the option repeatitems in xmlReader is set to true the id of the row can be set using the [[:wiki:colmodel_options |key option ]] in colModel | ||
Line 915: | Line 918: | ||
==== Function ==== | ==== Function ==== | ||
- | This option does not really define the datatype at all, but rather how to handle the data that is provided by the server (which would still come as either xml or json data). The functions defined as a Datatype should (or can) call addXMLData, addJSONData or addRowData once the data has been received. \\ | + | This option does not really define the datatype at all, but rather how to handle the data that is provided by the server (which would still come as either xml or json data). The functions defined as a Datatype should (or can) call addXMLData, addJSONData or addRowData once the data has been received. If you use a pager, it is useful to call your_grid.setGridParam({lastpage: your_number}) to specify the number of pages. \\ |
Calling Convention: | Calling Convention: | ||
<code javascript> | <code javascript> | ||
Line 1023: | Line 1026: | ||
userData = {totalinvoice:240.00, tax:40.00} | userData = {totalinvoice:240.00, tax:40.00} | ||
</code> | </code> | ||
- | The data can be accessed two ways. | + | The data can be accessed using a getGridParam method. To do that we need to request this data: \\ |
- | 1. Using a getGridParam method. To do that we need to request this data: \\ | + | <code javascript>jQuery("grid_id").jqGrid('getGridParam', 'userData')</code> |
- | <code javascript>jQuery("grid_id").getGridParam('userData')</code> | + | |
- | 2. Using the user contributed [[Post Data Module]] \\ | + | and using the old API (not preferr) |
- | <code javascript>jQuery("grid_id").getUserData()</code> | + | <code javascript>jQuery("grid_id").getGridParam('userData')</code> |
- | to get the entry array or | + | |
- | <code javascript>jQuery("grid_id").getUserDataItem( key )</code> | + | |
- | to get particular value with name = key | + | |