Hi Experts,
Can any of you help me on the following.
On my table I have to following code
items="{path: 'frontpage>/frontPages'}"
And on the components.js or the controller itself (i've tried both).
var oModelfrontpage = new sap.ui.model.json.JSONModel("model/frontpage.json"); //sap.ui.getCore().setModel(oModelfrontpage, "frontpage"); this.getView().setModel(oModelfrontpage,"frontpage");
Tried with getView and GetCore to assign the Omodel to the SName frontpage.
The so if I have 3 records inside the json, it creates three lines on the table, but does not populate the data.
If I do the following, and remove the frontpage> from the path it works.
this.getView().setModel(oModelfrontpage);
Why can't I set the specific name for that OData, and only works if set as the main OData?
Here's the JSON, and the XML for the table.
{ "frontPages": [ { "id" : "1", "icon" : "sap-icon://message-information", "text" : "Bank Shortage", "actual" : "10M", "target" : "20M", "change" : "3M", "imageUpDown" : "sap-icon://drill-up", "imageUpDownColor" : "green", "infoButtonAlt" : "Bank Shortage Information" }, { "id" : "2", "icon" : "sap-icon://message-information", "text" : "Bank Balances Available for Investment", "actual" : "30M", "target" : "20M", "change" : "39M", "imageUpDown" : "sap-icon://drill-down", "imageUpDownColor" : "red", "infoButtonAlt" : "Bank Balances Available for Investment Information" }, { "id" : "3", "icon" : "sap-icon://message-information", "text" : "Bank Balances Available for Investment", "actual" : "30M", "target" : "20M", "change" : "39M", "imageUpDown" : "sap-icon://drill-down", "imageUpDownColor" : "red", "infoButtonAlt" : "Bank Balances Available for Investment Information" } ] }
<Table class="sapUiSizeCompact"
noDataText="Drop column list items here and columns in the area above"
id="tableMainItems" headerDesign="Standard" mode="MultiSelect" selectionChange="handleListItemPress"
items="{path: 'frontpage>/frontPages'}"
select="handleListItemPress">
<customData>
<core:CustomData key="sap-ui-fastnavgroup" value="true" writeToDom="true" id="__data10"/>
</customData>
<items >
<ColumnListItem id="__item9">
<cells>
<core:Icon src="{icon}" size="1em" id="__icon0_copy" hoverColor="red" alt="{infoButtonAlt}"/>
<Text text="{text}" class="fontSize12" maxLines="0" id="__text7"/>
<core:Icon src="{imageUpDown}" size="1em" id="__icon0" activeColor="" color="{imageUpDownColor}"/>
<Text text="{actual}" class="boldText fontSize12" maxLines="0" id="__text7_copy"/>
<Text class="boldText fontSize12" text="{target}" maxLines="0" id="__text7_copy2"/>
<Text class="boldText fontSize12" text="{change}" maxLines="0" id="__text7_copy3"/></cells>
</ColumnListItem></items>
<columns>
<Column id="__column0" width="10px">
<header>
</header>
</Column>
<Column id="__column1" width="70px">
<header>
</header>
</Column>
<Column id="__column2" vAlign="Middle" width="5px">
<header>
</header>
</Column>
<Column width="40px" vAlign="Middle" id="__column2_copy">
<header>
<Label id="TR_ACTUAL_LABEL_copy" text="Actual" class="fontSize12" textAlign="Center" width="100%"/>
</header>
</Column>
<Column width="45px" vAlign="Middle" id="__column2_copy2">
<header>
<Label id="TR_ACTUAL_LABEL_copy2" text="Target" class="fontSize12" textAlign="Center" width="100%"/>
</header>
</Column>
<Column width="50px" vAlign="Middle" id="__column2_copy4">
<header>
<Label id="TR_ACTUAL_LABEL_copy4" text="Change" class="fontSize12" textAlign="Left" width="100%"/>
</header>
</Column></columns></Table>
Best
Leandro