cancel
Showing results for 
Search instead for 
Did you mean: 

Create sap.m.Table with xsodata service

0 Kudos
803

Hi,

I know there are already a lot of examples out there, but I still failed.
The setup is quite simple, I created a xsodata service file in the folder services "historyincoming.xsodata".

service {
"_SYS_BIC"."cosma_bca3/USER_HISTORY" as "History"
with ("GAMEID", "IN_AMOUNT", "IN_PRICE", "ROUND", "ROLE")
key ("GAMEID")
;
}

The xsodata service is working...

Now I just want to build a view with a sap.m.table to display some of the data.

I got a view "HistoryIncoming.view.xml" and I already created a table:

<mvc:View
	height="100%"
	xmlns:mvc="sap.ui.core.mvc"
	xmlns="sap.m"
	xmlns:t="sap.ui.table"
	controllerName="cosmacosma.controller.HistoryIncoming">
	<Page
		title="XXX"
		class="sapUiContentPadding"
		showNavButton="true"
		navButtonPress="onNavBack" >
		<headerContent>
				 <Label text="Round: {ModelRound>/round}"/>
		</headerContent>
		<subHeader>


		</subHeader>
		<content>
		<Table id="idHistoryIncoming"
				inset="true">
		<columns>
			<Column
				width="12em">
				<Text text="Round" />
			</Column>
			<Column
				minScreenWidth="Tablet"
				demandPopin="true">
				<Text text="Incoming Amount" />
			</Column>
			<Column
				minScreenWidth="Tablet"
				demandPopin="true"
				hAlign="Right">
				<Text text="Incoming Price" />
			</Column>
		</columns>
	</Table>
		</content>
		<footer>
			<Toolbar>
				<ToolbarSpacer/>
				<Button text="Next" press="onNavigate" />
			</Toolbar>
		</footer>
	</Page>
</mvc:View>

The UI looks like this:

Now my problem is to connect the table with my xsodata service. I tried many different things, but nothing worked. My HistoryIncoming.controller.js is empty at the moment. I would like to display the round, incoming amount and the incoming price from the xsodata service.

Hope somebody got some ideas - Thanks!

Best regards,

Felix

View Entire Topic
arthursilva
Active Participant
0 Kudos

Hello,

Did you correctly import the xsodata to your project ?

Just a few points to be considered:

1. Configure your hana server on Destinations on SCP;
2. Check whether file neo-app.json from your project is corretly pointing to the hana server

{
      "path": "/destinations/<server_destination_name_goes_here>",
      "target": {
        "type": "destination",
        "name": "<destination_name>"
    },
    "description": "<description>"
    }

3. Update manifest.json by adding a main service which points to the xsodata file.

"dataSources": {
  "mainService": {
    "uri": "/<destination_name>/public/iot/services/iot.xsodata",
    "type": "OData",
    "settings": {
      "odataVersion": "2.0",
      "localUri": "localService/metadata.xml"
    }
  }}

4. Now, you're ready to call the xsodatsa entity right out to your code.

<Table
  items="{
    path: '/History',
    sorter: {
      path: '',
      descending: false
    }
}"

Regards
Arthur Silva