Skip to Content

Cannot display i5Grid on UI5 based Web Page

Jan 03, 2017 at 08:37 PM


avatar image
Former Member


We are on MII

I am trying to create a Simple App using UI5 SplitApp as my root element following MVC architecture. I am trying to add an MII i5Grid to one of the detail pages. But for some reason the i5Grid is not getting displayed. Odd thing is I am getting the updationevent alert as well as html elements before and after this grid getting displayed. I am just seeing blank where i5Grid is supposed to get displayed.

I tested the display template from workbench and it is working fine. I placed it alone in a webpage and it worked.

I am attaching the code for xmlview and controller below. Let me know if you need any info.


		function (Controller,Filter,FilterOperator,utility) {
   "use strict";
   return Controller.extend("", {
	   onInit : function (evt) {
		onAfterRendering: function(){
			if(this._grid_topleft == undefined){
				this._grid_topleft = new"MIIPOC/Dashboard/DisplayTemplates/DisplayPIDatai5Grid","MIIPOC/Dashboard/QueryTemplates/GetPIDataXAcuteQuery");
				this._grid_topleft .setGridWidth("400px");
				this._grid_topleft .setGridHeight("300px");
				this._grid_topleft.registerUpdateEventHandler(function(){ alert(); });
				$("#"+this.getView().byId("dummyid").getId()).html("<h1>Please print this</h1>");
		toggleToMaxScreen : function(){

XML View

<mvc:View controllerName="" xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" 
	displayBlock="true" xmlns:html="" xmlns:l="sap.ui.layout">
	<Page title="Removedstringhere Metrics" titleLevel="H4" width="100%" showNavButton="false" height="100%">
			<ToolbarSpacer />
			<Button id="maximizeButton"
					tooltip="Toggle full screen"/>
				<Text id="topleftcelltext" text="test text"/>
				<html:div id="topleftcell" style="height:500px;width:700px">
			          <html:div id="dummyid" style="height:500px;width:700px">



Output in the js console...shows that Chart has been drawn at the div Id I gave.

chart draw - start
i5Grid.js:1003 chart position Id: __xmlview0--dashboardDetailsView--topleftcell
i5Grid.js:189 Initiliazing title bar
TitleBar.js:47 Initiliazing title bar for i5Grid
TitleBar.js:71 title bar Initiliazed and added
TitleBar.js:87 Initiliazing tool bar
TitleBar.js:89 tool bar Initiliazed and added
i5Grid.js:198 Initiliazing message bar
i5Grid.js:231 thisObj.getGridObject() -->
i5Grid.js:140 In init of Grid
sap-ui-core.js:160 2017-01-03 15:01:40.991989 registerResourcePath ('CustomControls', '/XMII/JavaScript/original/') -  sap.ui.ModuleSystem
i5Grid.js:1013 chart draw - end

Any help or pointers would be highly appreciated.


Ravi Kumar

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
avatar image
Former Member Jan 05, 2017 at 05:29 PM


I am able to fix the issue with the following code in my controller. Just helping out in case someone is trying to use UI5 MVC approach and trying to display MII objects on web pages.

Instead of using xhtml definition within my view to create grid's div container, I used sap.ui.core.HTML for creating the same.


Ravi Kumar

onAfterRendering: function(){
			var oHtml = this.byId("gridControl");
			if (!oHtml) {
				if(this._grid_topleft == undefined){
					var oHtml = new sap.ui.core.HTML(this.createId("gridControl"),
							{ content: '<div id="gridDisplayId" style="height:400px;width:50%"></div>', 
							preferDOM: true,
							afterRendering : function(oEvent) {
								if(sap.ui.getCore().getModel("dashboardstatus").getProperty("/dashboardstatus/dasboardpageid") == 0){
									this._grid_topleft = new"MIIPOC/Dashboard/DisplayTemplates/DisplayPIDatai5Grid","MIIPOC/Dashboard/QueryTemplates/GetPIDataXAcuteQuery");
									sap.ui.getCore().getModel("dashboardstatus").setProperty("/dashboardstatus/dasboardpageid", 1);
10 |10000 characters needed characters left characters exceeded