Skip to content

Instantly share code, notes, and snippets.

@xcooper
Created August 12, 2013 09:55
Show Gist options
  • Save xcooper/6209598 to your computer and use it in GitHub Desktop.
Save xcooper/6209598 to your computer and use it in GitHub Desktop.
overwrite jqGrid ajax mechanism, send json to backend instead of submitting a form. datatype should be "json" "xml" "script" postData is data you wanna send ajaxGridOptions is ajax configuration of jQuery serializeGridData is a function having only one argument which is postData you provided, it should return a Serialized data(e.g. String)
self.grid.jqGrid("setGridParam", {
serializeGridData: self.serializeData,
url: self.executionUrl,
datatype: "json",
ajaxGridOptions: {
cache: false,
contentType: "application/json",
processData: false,
type: "POST"
},
postData: {
reportId: self.reportId,
userCondition: self.userCondition.toJSON(),
criterionType: self.getCriterionTypeValue()
}
});
self.grid.trigger("reloadGrid");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment