1
Help for ParamQuery Pro / Is it possible to dynamically change the dataModel?
« on: December 28, 2023, 07:41:53 am »In version 8.x, it was used as follows:
Code: [Select]
-- Initial settings
dataModel: {data: []}
-- When clicking the search button
$("#btnSearch").click(function() {
var postData = $(form + " :input").serializeObject();
var dataModel = {
location: "remote",
dataType: "JSON",
method: "POST",
url: $(form).attr("action"),
postData: postData
};
$("#gridDiv").pqGrid("option", "dataModel", dataModel);
$("#gridDiv").pqGrid("refreshDataAndView");
});
However, in version 9.x an error occurs.
pqgrid.min.js:9 Uncaught TypeError: Cannot read properties of undefined (reading 'bind')
at A.callXHR (pqgrid.min.js:9:62732)
at A.remoteRequest (pqgrid.min.js:9:63058)
at A.refreshDataAndView (pqgrid.min.js:9:66110)
at HTMLDivElement.<anonymous> (jquery-ui.min.js:6:8934)
at Function.each (jquery-2.2.4.min.js:2:2861)
at a.fn.init.each (jquery-2.2.4.min.js:2:845)
at e.fn.<computed> [as pqGrid] (jquery-ui.min.js:6:8817)
at HTMLDivElement.<anonymous> (uprt.common.js?ver=2022052101:43:17)
at HTMLDivElement.dispatch (jquery-2.2.4.min.js:3:7537)
at r.handle (jquery-2.2.4.min.js:3:5620)
In version 9.x, how do the grid display data only when the search button is clicked without searching the data when entering the page?