1
Help for ParamQuery Grid (free version) / Re: Saving data to a remote location using a custom script
« on: January 26, 2015, 04:26:59 am »
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));
});
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));
});