ParamQuery grid support forum
General Category => Help for ParamQuery Grid (free version) => Topic started by: atkingtornado on January 23, 2015, 12:13:27 am
-
I am trying to save data to a remote location using paramquery, I am reading the JSON file with a python script and then passing that data to paramquery. The location on the webserver where the code is located is not writable from the web, hence the need for a custom function. IS there a way to get the data from the grid and then send it back out to the remote location?
Thanks!
-
The whole data of the grid i.e., dataModel.data (which is simply an array of row objects) can be sent to remote server with $.ajax POST.
-
Thank you for your reply!
When I try to print out dataModel.data to the console... for some reason It's not retrieving the data as it should. Here's my code:
$(document).ready(function(){
var colM = [{ title: "DQPR", width: 100, dataType: "string", dataIndx: "dqpr" },
{ title: "Status", width: 200, dataType: "string", dataIndx: "status" },
{ title: "First Name", width: 200, dataType: "string", dataIndx: "firstName" },
{ title: "Last Name", width: 200, dataType: "string", dataIndx: "lastName" }
];
var dataModel = {
location: "remote",
sorting: "local",
paging: "local",
dataType: "JSON",
method: "GET",
sortIndx: "dqpr",
sortDir: "up",
getUrl: function () {
return{ url: "cgi-bin/get_json.py"}
},
getData: function (dataJSON) {
var data = dataJSON.data;
return { data: dataJSON.data };
}
};
var newObj = {
flexHeight: true,
flexWidth: true,
dataModel: dataModel,
bottomVisible: true,
colModel: colM,
selectionModel: { mode: 'single' },
editable: false,
scrollModel: { horizontal: false },
title: "DQPR Data",
columnBorders: true
};
var $grid = $("#grid_json").pqGrid(newObj);
console.log(JSON.stringify(dataModel.data));
});