Hi when I call this function in my file ResultDevice.controller.js it loads the devices perfectly in the ResultDevice.view.xml. Now I want to call the function in my BaseController,because I have multiple Controllers & Views and need to acess them, but my View is not builded. I dont have a Error Code, when I paste console.log under this.getView it returns my Call. So I think he cant connect to “aribadevices” from the BaseController.js in the ResultDevice.view.xml file. I tried to paste id=”idView1″ in the this.getView(“idView1”) but then I get an error that he cant find the View “idView1”
Please Help me xd…
the Base Controller Function:
onCompletedNotebook: function (oEvent) {
const tabletUrl = '/api/tablets?limit=1000&offset=0';
fetch(tabletUrl).then(res => res.json()).then(res => {
const dataModel = new JSONModel();
dataModel.setData({
items: res
});
this.getView().setModel(dataModel, "aribadevices")
})
},
``` The View from ResultDevice.view.xml: ```
<mvc:View id="idView1" controllerName="TESTE.TESTE.controller.ResultDevice" xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m"
xmlns:card="sap.f.cards" xmlns:f="sap.f">
<App>
<pages>
<Page title="ResultDevice" showNavButton="true" navButtonPress="oNavButton_press">
<content>
<List items="{aribadevices>/items/results}">
<items>
<CustomListItem class="list">
<f:Card class="sapUiMediumMargin" width="300px">
<f:header>
<card:Header title="{aribadevices>name}"/>
</f:header>
<f:content>
<Text text="{aribadevices>name}"/>
</f:content>
</f:Card>
</CustomListItem>
</items>
</List>
</content>
</Page>
</pages>
</App>
</mvc:View>