Can someone post a demo or a piece of code, to exemplify how to use jqpivot and loading data using ajax. Thank you.
相关问题
- How to bind a dropdown list inside jqgrid row cell
- jQgrid filterToolbar fails with searchOnEnter
- Detecting checkbox event in jqGrid cell
- How to alter data received from the server before
- How to access other row data from a cell's cus
相关文章
- jqGrid Row Object in onSelectRow
- Weird behavior of jqgrid Grouping
- jQuery - jqGrid - submit buttons in each row
- JqGrid: sorting of local data
- How to Expand/Shrink row in Jqgrid dynamically
- VB.net FileUpload using Ajaxcall
- jqGrid addRowData doesn't work with grid as su
- How to turn off column highlighting (on hover) for
I would recommend you to examine the source code of free jqGrid. Look at the part of the code. It looks like
You will get practically directly the answer on your question. You need specify the URL to the server which provides the input data in JSON form. No other data format is supported (
"xml"
,"jsonp"
and so on) directly, but you can useajaxOpt
parameter to overwrite the parameters of the Ajax call. It's important to understand additionally, that jqGrid uses$.jgrid.getAccessor
method to read the data from the server response. The default data format should be the following:where the value of "rows" should have the same format as the
data
parameter ofjqPivot
if you use if without Ajax. If you have for examplethen you can use 4-th parameter of jqPivot (
ajaxOpt
) asIf the response from the server is array of data:
or it have some non-standard form than you can use function form of
reader
. For exampleThe above code specify the reader at the function which use all the response data directly (without object with
rows
property). It specifiescontentType
andtype
parameter of the jQuery.ajax and the callback functionerror
.If all the options seems you too difficult you can load the data directy in your code with direct call of
jQuery.ajax
for example and the calljqPivot
after the data are loaded (inside ofsuccess
callback ordone
).