on 04-25-2016 3:49 PM
Dear Experts,
I'm trying to use a Navigation Link for binding data to a table in the Master-Detail Template for SAP UI5. To understand my problem, let me introduce you to my solution thus far:
I have an OData 2.0 Service designed in the Gateway which offers me the following service:
To summarize I have a central Service which links to two Entities via two Navigation Links. I designed it this way to have "table-in-table" datastructure in the end. In theory this works very well and even when testing it in the browsers I didn't encounter any problems. But the next step is where it gets difficult.
So I generated my Master-Detail Project via the HCP, but I'm editing it locally. Since I want to make a Fiori Application the views are XML-based. The goal is to show all contents of the DumpTabelleSet in the Detail view (which works great!) and to have a table with the contents of both of the two linked Entities on the page as well. Since the template does some Model-Binding-Magic behind the scenes in the controller, I access the contents of the DumpTabelleSet by using a direct reference.
<ObjectHeader id="objectHeader" title="Dump-Typ: {Dumpid}" numberUnit="{Syuser}"> |
But the problems arise when I want to use the entities from the Nnvigation link. So far I have this piece of code:
<Table items="{path: 'VersionsTabelleSet>/'}"> | ||||
<columns> | ||||
<Column> | ||||
<header> | ||||
<Label text="Header 1" id="__label0"/> | ||||
</header> | ||||
</Column> | ||||
</columns> | ||||
<items> | ||||
<ColumnListItem> | ||||
<cells> | ||||
<Text text="{HostKuerzel}" /> | ||||
</cells> | ||||
</ColumnListItem> | ||||
</items> | ||||
</Table> |
But that results in a simple "No Data" output inside of the table.
I would be very grateful for any recommendations!
Thanks in advance,
Jan
So I found the answer to my problem using the SAP Web IDE with it's OData Service Discovery features.The following code works in my example:
<Table items="{DumpVersionsNav}">
<columns>
<Column>
<Text text="Hostkuerzel"/>
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<ObjectNumber
unit="{Hostkuerzel}"/>
</cells>
</ColumnListItem>
</items>
</Table>
By using the Navigation Link in the items attribute of the table, SAP UI5 knows how to find the set behind that.
After setting it right, you can easily access all of the attributes of the set by just using their name.
This effectively allows table-in-table data structures, which is great in case you have complex data structures to work with.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
seems like you are using a named model and you are missing the end point.
if so, then make sure you have : on your table binding... path: 'nameModel>/ENDPOINT'
then in the column cells binding .... you should have 'nameModel>COLNAME'
hope this help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, that would change my code to this, I believe:
<Table items="{path: 'detailView>/VersionsTabelleSet'}">
<columns>
<Column>
<header>
<Label text="Header 1" id="__label0"/>
</header>
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Text text="{detailView>/HostKuerzel}" />
</cells>
</ColumnListItem>
</items>
</Table>
But it then throws me an error:
"Resource for segment ''>'' not found"
"'>' stands for the greater sign and it actually throws me that error twice, once for the path and once for the column, I think.
The name of the model should be accurate, since the _onMetadataLoaded function loads it via oViewModel = this.getModel("detailView");
you should see the odata model or json model both.. in your odata service.. right click, run as xs service.. it should open your browser with the end points.. once there you should see the end point you are looking for.. then you can debug whether or not the data is being returned from your service
Hi Jan,
Can you share model definition (like how you're setting the model) also the screenshot of model response.
Regards,
Sai Vellanki.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sai,
Like mentioned above I use the standard template for master-detail from the SAP HCP Web IDE.
When navigating to a DetailView, which is the case here, it calls the _showDetail Function:
_showDetail : function (oItem) { | ||||
var bReplace = !Device.system.phone; | ||||
this.getRouter().navTo("object", { | ||||
objectId : oItem.getBindingContext().getProperty("Dumpkey") | ||||
}, bReplace); | ||||
}, |
With the model response you mean a XML repsonse from the Odata service? If so, a Query or a Read?
Try providing the path for the table as items="{VersionsTabelleSet}" .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm afraid that didn't solve the problem. I am getting a "Resource for segment 'VersionsTabelleSet' not found" error in console though. But that seems like a very generic error when a databinding against an odata service just doesn't work.
Additionally I'm not sure if it works that way. The VersionsTabelleSet has to be called with the specific key (Dumpkey), which is automatically set when clicking on an Item in the MasterView. I think this because I can access the properties of DumpTabelleSet by just writing the property names (i.e. Dumpid) and not the full OData Path(ie. DumpTabelleSet('<mykeyhere>')/Dumpid). But when is assertion is true, the Navigation via just writing VersionsTabelleSet wouldn't use the key, I believe.
User | Count |
---|---|
78 | |
9 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.