I have a grid that renders and shows no data even though the object referenced in the .load statement has data. Only the header row is shown in the grid and when the object is inspected, there are not additional data rows in the resulting table. The code is as follows:
$(’#openCustomerMonthlyRevenueDiv’).dialog({
autoOpen: false,
resizable: false,
modal: true,
width: 400,
height: 300,
position: [“center”, “top”],
closeOnEscape: true,
open: function (event, ui) {
$(this).load(monthlyRevenueGridURL, {
monthlyid: monthlyId
}, function (data) {
debugger;
var annualizationEntity = [];
annualizationEntity = JSON.parse(data);
var CustomerAnnualizationRevenueGrid = new dhtmlXGridObject('openCustomerMonthlyRevenueDiv');
CustomerAnnualizationRevenueGrid.setImagePath("../../content/codebase/imgs/");
CustomerAnnualizationRevenueGrid.setHeader("Id,ToolsId,Year,Month,Estimated Revenue (Euro)");
CustomerAnnualizationRevenueGrid.setColumnIds("_Id,_ToolsId,_Year,_Month,_EstRevenue");
CustomerAnnualizationRevenueGrid.setInitWidths("30,50,50,100,100");
CustomerAnnualizationRevenueGrid.setColAlign("left,left,left,left,left");
CustomerAnnualizationRevenueGrid.setColTypes("ro,ro,edn,ed,edn");
CustomerAnnualizationRevenueGrid.init();
CustomerAnnualizationRevenueGrid.load(annualizationEntity, "js");
var div = document.getElementById("openCustomerMonthlyRevenueDiv");
div.style.visibility = 'visible';
div.style.display = 'block';
div.style.height = '375px';
});
},
close: function () {
},
overlay: {
opacity: 0.2,
background: "black",
}
});
When I step through the code, the annualizationEntity is an array with each element looking as below:
annualizationEntity[10]
{…}
proto: {…}
_EstRevenue: 0
_Id: 0
_Month: “November”
_ToolsId: 0
_Total: 0
_Year: 0
The array elements match the column ID names. What could be the cause of the data not appearing in the grid?