Skip to Content
avatar image
Former Member

unable to load json data in xml view

I am new to SAPUI5, and was working on a application project in mvc format, using the Quickviewcard format for view.

When I load json data in my controller file, the application is displayed correctly as below:

But when I load the data from a separate json file,

I don't get the required output.

Here's the screenshot:

Here below is the json code:

If you see, it is displaying only until, the content of 1st element of array in 'elements' section of json

	"pages": [{
		"pageId": "companyPageId",
		"header": "Company info",
		"title": "Customer",
		"icon": "sap-icon://contacts",
		"groups": [{
			"heading":	"List",
				"elements": [{

										"label": "Status",
					"value": "Active",
					"elementType": "sap.m.QuickViewGroupElementType.text"
				}, {
					"label": "Role",
					"value": "Customer",
					"elementType": "sap.m.QuickViewGroupElementType.text"

				}, {
					"label": "Accountable",
					"value": "Dirk Bommelberg",
					"elementType": "sap.m.QuickViewGroupElementType.pageLink"
				}, {
					"label": "Main Contact",
					"value": "Udo Zimmermann",
					"elementType": "sap.m.QuickViewGroupElementType.pageLink"
				}, {
					"label": "Classification",
					"value": "A",
					"elementType": "sap.m.QuickViewGroupElementType.text"
				}, {
					"label": "Address",
					"value": "CA, 94102 San Francisco USA",
					"elementType": "sap.m.QuickViewGroupElementType.text"
				}, {
					"label": "Telephone",
					"value": "+001 6101 34869-0",
					"elementType": "sap.m.QuickViewGroupElementType.text"

I am using the following code to load the json in my controller.js And view file(fragment) is after that

var oModel = new JSONModel("sap.ui.demo.mock", "/contact.json"));
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core">
	<Panel id="quickViewCardContainer" width="300px" height="600px">
		<QuickViewCard id="quickViewCard" pages="{path : '/pages', templateShareable : 'true'}" afterNavigate="onNavigate">
			<QuickViewPage pageId="{pageId}"
					groups="{path : 'groups', templateShareable : 'true'}">
				<QuickViewGroup heading="{heading}" elements="{path : 'elements', templateShareable : 'true'}">

1.jpg (27.2 kB)
2.jpg (14.7 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Dec 05, 2016 at 09:58 AM

    Hello Suraj,

    You must be initiating the Fragment in the controller. (sap.ui.xmlfragment) While initiating it, pass the view instance as the second parameter.

    oDialog = sap.ui.xmlfragment("project.view.HelloDialog",this);
    Add comment
    10|10000 characters needed characters exceeded