on 12-10-2021 3:00 PM
Hello, I want to bind some JSON to a Table (sap.ui.table). However the binding is not working. Here is my code:
After the API call, the content is bound to the table like this:
this.getView().byId("elementsItemsTable").setModel(new JSONModel(), "elementItemsTableModel");
this.getView().byId("elementsItemsTable").getModel("elementItemsTableModel").setData(elementItems.data);
The table in xml:
<table:Table id="elementsItemsTable" visible="false"
rows="{ path: 'elementItemsTableModel>/' }">
<table:extension>
<OverflowToolbar style="Clear">
<Title id="title" text="Longest running elements"/>
<SearchField
placeholder="Filter"
value="{ui>/globalFilter}"
search="filterGlobally"
width="15rem"/>
</OverflowToolbar>
</table:extension>
<table:columns>
<table:Column filterProperty="Phasename"
showFilterMenuEntry="true">
<Label text="Product Name" />
<table:template>
<Text text="{/name}" wrapping="false" />
</table:template>
</table:Column>
<table:Column>
<Text text="Duration"/>
</table:Column>
</table:columns>
</table:Table>
However no content is show. There are 10 rows displayed but not the "name" in the first column. I guess somewhere is missing something small.
Thanks
make sure it is pointing to the array rows="{ path: 'elementItemsTableModel>/' }">
then, here you need the model name in the binding.
<Text text="{elementItemsTableModel>name}" wrapping="false" />
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
6 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.