i want to bind a global Model and access this in different xml views but it always shows no content.
In the Controller i bind the data this way...
sap.ui.define([
'jquery.sap.global',
'sap/ui/core/mvc/Controller',
'sap/ui/model/json/JSONModel'
], function (jQuery, Controller, JSONModel) {
"use strict";
return Controller.extend("sap.ui.demo.controller.DatasourceManagement", {
onInit: function() {
var datasourcesModel = new JSONModel('/api/datasources');
sap.ui.getCore().setModel(datasourcesModel, 'datasources');
//this.getView().setModel(datasourcesModel,'datasources');
},
....
And in the View i try to access the data this way...
mvc:View xmlns="sap.m" xmlns:tnt="sap.tnt" xmlns:l="sap.ui.layout"
xmlns:mvc="sap.ui.core.mvc"
controllerName="sap.ui.demo.controller.DatasourceManagement">
<Page showHeader="false" enableScrolling="true" class="sapUiContentPadding test"
showNavButton="false">
<content>
<Table id="datasourceTable"
items="{path: 'datasources>',
sorter: {
path: 'id'
}}"
....
What is the problem with my code?
-------EDIT 1------------- The URL "/api/datasources" returns an array of entries:
[
{
"id": 1,
"name": "FTPSERVER",
"hostname": "test.de",
"port": 21,
"username": "username",
"password": "password"
},
{
"id": 2,
"name": "FTPSERVERasdasdasdadsads1111111",
"hostname": "test.de",
"port": 21,
"username": "username",
"password": "password"
},
{
"id": 3,
"name": "FTPSERVER",
"hostname": "test.de",
"port": 21,
"username": "username",
"password": "password"
}
]