cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 SmartTable

former_member89149
Participant
372

Hi all!

I try to reproduce sample from sapui5 smarttable: there are metadata.xml, Products.json. But ODataModel is not filled with data.

Main.view.xml

<Page title="{i18n>title}">
	<content>
		<smt:SmartTable
				entitySet="Products"
				tableType="AnalyticalTable"
				useVariantManagement="false"
				useTablePersonalisation="true"
				header="Products"
				showRowCount="true"
				enableAutoBinding="true" />

Main.controller.js

onInit: function () {
	var oViewModel;
	oViewModel = new JSONModel();
	oViewModel.loadData("localService/Products.json", false);
	this.getView().setModel(oViewModel, "appView");
	this.getOwnerComponent().getModel("nwind").metadataLoaded();
}

What can be wrong in this code?

Thank you

Hello Denis,

Any errors in the console?

Thanks,

Gowtham Karanam

Accepted Solutions (1)

Accepted Solutions (1)

Joseph_BERTHE
Active Contributor

Hello,

To use a smarttable you need an OData model and not a JSON model (it is possible but much more complex).

To do the demo project, if you have not a ODATA service available in you backend system then you need to simulate it thanks to a mockserver. Please refere to the documentation to know how to use mock data server in UI5.

Kund regards,

Joseph

xushiyiren
Discoverer
0 Kudos

您不能在Smarttable中使用任何其他模型。您只能使用ODataModel读取和获取数据

Joseph_BERTHE
Active Contributor
0 Kudos

Hope my translation engine worked well 🙂

其实,我看到有一个博客曾尝试使用JSON模板,但显然这是绝对不能做的。所以是的,SmartTable接受ODATA。

Regards,

Answers (1)

Answers (1)

former_member723794
Participant

Hi Denis Kitrish,

As you are using Smart Table, which will only works with OData. If you do not have OData Service, then you can test with Mockserver.

As you are trying with JSON Model, So you are not getting results.

If you want to know more, please refer this link for reference.

https://answers.sap.com/questions/90310/application-with-smarttable-and-jsonmodel-binding.html

Thanks and regards,

Chaitali Pandya