I am trying to use expand
option in my XML view but it\'s resulting no data.
Data are coming from backend as I can see in debugging under \'Ne
Here I created a running example from your code: https://plnkr.co/edit/a2pcO6.
In the production code, remove all mock server references.
According to your service metadata, the foreign key inside matdetails
is also the only primary key at the same time. I.e. the Matid
s in matdetails
cannot be unique if one matlist
is supposed be associated with multiple matdetails
entities.
this.setModel(odata, "odata")
<Text text="{Matid}"/>
"results"
which ODataModel cannot deal with. Same as this issue, the "response"
property needs to be there in each collection so that UI5 can display the items correctly. Not sure about the cause though as I don't have any expertise in backend. Having all entities uniquely identifiable might resolve this problem.<App>
from your table view. An application should contain only one root element. If not, you might end up having this kind of problems.Since you want to display matdetails
entities of selected matlist
entity in the table, binding items there with the absolute path /matlistSet
doesn't make sense. So, replace ..
items="{ path: 'odata>/matlistSet', parameters: { expand: 'NP_ON_MATID' } }"
.. with just items="{odata>NP_ON_MATID}"
. This binding is now relative. The property NP_ON_MATID
will be resolved once the selected context is given which is done in the controller..
On patternMatched
, the selected Matid
value is given. So far so good but there are two anti-patterns in the following lines:
var params = "('" + data + "')?$expand=NP_ON_MATID"; var path = "/matlistSet" + params + "";
?$expand
manually as it won't expand the entity. Pass the navigation property to the parameters/expand
of bindElement instead.Off-topic but if you want to navigate back: Remove window
parameter from onNavBack: function(window) { ... }
. Otherwise, the window
in window.history.go
is not the global window object but the press event from the back button.