Easy Way to Bind Northwind Data
This blog is for the beginners who find difficult to understand binding of odata.
All you have to do is to trust Descriptor Editor in manifest.json and it will take care of your complex code to be written in manifest.json and neo-app.json.
- Make the below destination in hanatrial.
2. Create a Project from the template “SAPUI5 Application”.
Click on “Next”. Give Project Name and Namespace and click on Finish Button.
3. Below is the structure created.
Go to “Descriptor Editor” of “manifest.json”. It will look as shown in figure below.
Click on Data Sources and click on + button and make the entries as shown in figure. Click on test to get the collection in services. Click on Next then Finish.
The URL used to read the northwind service is http://services.odata.org/V2/Northwind/Northwind.svc/
In “Choose a system to connect the required service”, the only service will be displayed for which destination is set up in hanatrial.If no service is coming up in list, make the destination in hanatrial as shown in first figure.
4. Now click on Models and click on + button.
5. Enter any Model name and select data source and click on ok button.
The screen will look like this.
6. Go to view and write the below code.
<List items="{NorthwindNamedModel>/Customers}">
<items>
<ObjectListItem title="{NorthwindNamedModel>CompanyName}"/>
</items>
</List>
Save your code and Run the project.
Any suggestions/ questions are welcome.
Thanks
Kiran Israni
Beautiful, thank you from 2020.
hi Kiran,
I am getting the below error when i am trying to bind northwind can u help me out
Access to XMLHttpRequest at 'https://services.odata.org/V2/Northwind/Northwind.svc/$batch' (redirected from 'http://localhost:50212/northwind/V2/Northwind/Northwind.svc/$batch') from origin 'http://localhost:50212' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.