Greetings All,
I'm using MII 14 SP08, and I'm attempting to utilize the i5Grid similarly to how Applets were interrogated in 11.5.
The page code below does the following fine:
- Load the blank page, and all of the bootstrap references.
- The onld function creates a ui5Grid in the div element and populated the grid with data. Created a global variable to reference later.
- Since an UpdateEvent is registered it does get called and the current date & data from the table is printed into message div and looks great.
The issue seems that the UpdateEvent function does get called but the data from the i5Grid doesn't seem to be available - gets IE Error:
SCRIPT5007: Unable to get property '0' of undefined or null reference
File: BaseComponent.js, Line: 119, Column: 13
So guessing the global variable reference to the i5Grid is no longer valid object. How can this object be referenced by other function calls?
<SCRIPT type="text/javascript" src="/XMII/JavaScript/bootstrap.js" data-libs="i5Chart,i5Grid">
</SCRIPT>
<SCRIPT>
var i5Grid ;
function onld() {
i5Grid = new com.sap.xmii.grid.init.i5Grid("west_test/UI5/i5Grid", "west_test/UI5/CurrentTag_w_Alarm");
i5Grid.setGridWidth("900px");
i5Grid.setGridHeight("200px");
i5Grid.registerUpdateEventHandler(i5Grid_UpdateEvent);
i5Grid.draw("myDiv");
}
function i5Grid_UpdateEvent(){
var temp = i5Grid.getGridObject();
document.getElementById("message").innerHTML += Date() + "<br />" ;
var irows = temp.getRowCount();
var icols = temp.getColumnCount();
for(var irow = 1; irow <= irows; irow++) {
for(var icol = 1; icol <= icols; icol++) {
document.getElementById("message").innerHTML += temp.getCellValue( irow, icol) + " --- " ;
}
document.getElementById("message").innerHTML += "<br />" ;
}
}
</script>
</head>
<body onload="onld()">
<div id="myDiv"></div>
<div id="message"></div>
</body>
Thank you,
Dennis