ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: choidongjun on March 31, 2020, 11:01:41 am
-
Hi,
I want to use postdata dynamically using a check button or input box.
How to change the postdata and reload data?
$(function () {
var colModel= [
{ title: "Product ID", dataType: "integer", dataIndx: "ProductID", editable: false, width: 80 },
{ title: "Product Name", width: 165, dataType: "string", dataIndx: "ProductName" },
{ title: "Quantity Per Unit", width: 140, dataType: "string", align: "right", dataIndx: "QuantityPerUnit" },
{ title: "Unit Price", width: 100, dataType: "float", align: "right", dataIndx: "UnitPrice" },
{ title: "Units In Stock", width: 100, dataType: "integer", align: "right", dataIndx: "UnitsInStock" },
{ title: "Discontinued", width: 100, dataType: "bool", align: "center", dataIndx: "Discontinued" }
];
var postData = {gridId:23, table: "products"};
var dataModel = {
location: "remote",
dataType: "json",
method: "GET",
url: "/pro/products/get_jsonp",
postData: postData,
getData: function (dataJSON) {
return {data: dataJSON.data};
}
};
$("#grid_jsonp").pqGrid({
height: 450,
scrollModel: {autoFit: true},
dataModel: dataModel,
colModel: colModel,
numberCell: { resizable: true, width: 30, title: "#" },
title: "Products",
resizable: true
});
});
-
postData can be implemented as a callback function in which you can check value of check button and input box and return value dynamically.
https://paramquery.com/pro/api#option-dataModel-postData
Data can be reloaded through call to refreshDataAndView() method.
https://paramquery.com/pro/api#method-refreshDataAndView