struts-community-plugins / struts2-jquery

Struts2 jQuery Plugin
Apache License 2.0
83 stars 49 forks source link

jqGrid: load local JSON data #87

Open sytolk opened 7 years ago

sytolk commented 7 years ago

Can I skip href parameter <sjg:grid dataType="json" href="%{remoteurl}" and one I/O request and load local JSON or datatype: "local data like this: http://stackoverflow.com/questions/6831306/load-local-json-data-in-jqgrid-without-addjsonrows

If I load array of grid rows in the struts2 Action and write it like JavaScript array in web page its not need browser with JavaScript (Ajax) to call another Struts2 Action which return JSON data. Its need to have only: <sjg:grid data=strutsActionArray

flofourcade commented 7 years ago

If jou want to avoid one I/O request cycle, you can simply use the gridModel attribute of the grid tag. It will retrieve data from the action, so no need to use AJAX.

You'll find sample code in the showcase app http://struts.jgeppert.com/struts2-jquery-showcase/.