cancel
Showing results for 
Search instead for 
Did you mean: 

UI5 Table binding not working

kulu
Explorer
0 Kudos

Hello,

I have a List object which I want to bind to a table. However I don't get it. I followed the example but something is not working. There is no error message so that also does not help.

My list looks something like this:

result= {
    statementList = [
         {
              importance = "ASD",
              ...
         },
         {
             importance = "BDS",
             ...
         }       
    ]
}

My binding is initiated with this:

var result = JSON.parse(aData.responseData);
that.getView().byId("statementsTable").setModel(new JSONModel(), "statementTableModel");<br>that.getView().byId("statementsTable").getModel("statementTableModel").setData(result.statementList);

And the table is copy/pasted and adjusted from the example:

<Table id="statementsTable"
inset="false"
items="{ path: 'statementsTableModel/' }">
<infoToolbar>
<OverflowToolbar>
<Label text="Statements and Recommendations"/>
</OverflowToolbar>
</infoToolbar>
<columns>
<Column
width="12em">
<Text text="Severity" />
</Column>
<Column
minScreenWidth="Tablet"
demandPopin="true">
<Text text="Text" />
</Column>
</columns>
<items>
<ColumnListItem vAlign="Middle">
<cells>
<Text
text="{statementsTableModel>severity}"/>
<Text
text="{statementsTableModel>text}" />
</cells>
</ColumnListItem>
</items>
</Table>
Last time I was missing something really small so I guess that is again the problem.

Thanks for any input!

View Entire Topic
vneecious
Advisor
Advisor

After the name of your model you forgot to put a ">".

// Wrong
<Table id="statementsTable"
inset="false"
items="{ path: 'statementsTableModel/' }">
// Right
<Table id="statementsTable"
inset="false"
items="{ path: 'statementsTableModel>/' }">
kulu
Explorer
0 Kudos

Thanks for the solution!

Because I happen to have this problem now multiple times: Is there any way to get a warning when a binding is not working?

Its kind of hard to spot one missing '>' in the code...

vneecious
Advisor
Advisor
0 Kudos

You can check it using the Diagnostic Tool (just hold Control + Shift + Alt + S in your application). In the Control Tree section you will find some information about the Bindings. There you can check whether the binding is valid or not 🙂

0 Kudos

Hi Vincius!

What is the use of inset=false in the table tag?