ParamQuery grid support forum
General Category => Help for ParamQuery Grid (free version) => Topic started by: stelco on September 01, 2014, 10:24:22 pm
-
Hi, I have a working grid with my JSON data being read from a remote .json file. The issue I have is that the data doesnt load (display) on page load, it only loads (displays) after selecting an Rpp option from the drop down. Can anyone suggest how I would go about displaying the data on page load...does the initial Rpp option need to automatically refresh or something?
rPP: 20,
rPPOptions: [1, 10, 20, 30, 40, 50, 100, 500, 1000],
curPage: 1,
Here is my complete code:
<script type="text/javascript">
$(function () {
var colM = [
{ title: "Model", width: 300, dataIndx: "Model" },
{ title: "Repayments", width: 100, dataIndx: "Repayments" },
{ title: "Term", width: 100, dataIndx: "Term" },
{ title: "CapID", width: 100, dataIndx: "CapID" },
];
var dataModel = {
location: "remote",
sorting: "local",
paging: "local",
dataType: "JSON",
method: "GET",
sortIndx: 2,
sortDir: "up",
rPP: 20,
rPPOptions: [1, 10, 20, 30, 40, 50, 100, 500, 1000],
curPage: 1,
getUrl: function () {
return { url: "js/vehicles.json" }
},
getData: function (dataJSON) {
return { data: dataJSON };
}
}
var grid1 = $("div#grid_paging").pqGrid(
{
width: 700, height: 600,
dataModel: dataModel,
colModel: colM,
title: "Car Models",
resizable: true,
columnBorders: true,
//freezeCols: 2
});
});
</script>
<div style="margin:10px" id="grid_paging"></div>
-
Can anybody advise about this please?
-
The reason for your issue is difficult to tell by looking at your code. No you don't need to do any refresh of rPP
Put a breakpoint in getData callback and see when the method is called and what is the argument value i.e., dataJSON.
-
Hi,
please see the following video. The GET request just keeps looping: http://screencast.com/t/wMcj4Qbvt
-
I appear to have fixed this. It was the sort Index. It works without using sortIndx or selecting a column heading. All data loads on page load now.
var dataModel = {
location: "remote",
sorting: "local",
paging: "local",
dataType: "JSON",
method: "GET",
// sortIndx: "CapID",
sortDir: "down",
rPP: 20,
rPPOptions: [1, 10, 20, 30, 40, 50, 100, 500, 1000],
curPage: 1,
getUrl: function () {
return { url: "js/vehicles.json" }
},
getData: function (dataJSON) {
return { data: dataJSON };
}
}