Skip to Content
0

ui 5 xmlview aggregat binding

Mar 31, 2017 at 10:25 AM

39

avatar image

I have to change code from JS view to xmlview in a ui5 app.
I have a view with an table but i dont get any data shown in the table:
In the controller i set the model as following

onInit: function() {

var mat = { Materials : [ {"Name": "Aduct", "Menge" :"1"},
{"Name": "Pruc" , "Menge" :"2"},
{"Name": "Prt", "Menge" :"3"} ] };
var oModel1 = new sap.ui.model.json.JSONModel(mat); this.getView().setModel(oModel1,"MatModel");

and in the view i have the following code:

<Table id="idTable2" items="{MatModel>/Materials}" >
<columns>
<Column>
<header>
<Text text= "Name" />
</header> </Column>
<Column> <header>
<Text text= "Menge" />
</header>
</Column> </columns> <ColumnListItem>
<Text text="{Name}" />
<Text text="{Menge}" />
</ColumnListItem>
</Table>

Can someone give me a hint whats wrong with the databinding.
I get free empty lines in the table but no data.

Regards

Dirk

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Akhilesh Upadhyay Mar 31, 2017 at 12:47 PM
0

write <Text text="{MatModel>Name}" /> not <Text text="{Name}" />

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Mar 31, 2017 at 03:16 PM
0

Could you change following lines to these and try if it is working.

this.getView().setModel(oModel1);

<Table id="idTable2" items="{/Materials}" >

Share
10 |10000 characters needed characters left characters exceeded