Hello!
I need help.
I have a dialog window (sap.ui.xmlfragment). In this window I create a JSON model:
var PositionsSPD = new JSONModel({
items: []
});
this.getView().setModel(PositionsSPD, "PositionsSPD");
In view:
<m:Table id="lineSPDTableId"
....
items="{path: 'PositionsSPD>/items'}">
<m:items>
<m:ColumnListItem type="Active">
<m:cells>
<m:Text text="{PositionsSPD>DocNumExt}" width="auto" maxLines="2" wrapping="true" textAlign="Begin" textDirection="Inherit"/>
<m:Text text="{PositionsSPD>DocDate}" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit"/>
<m:Text text="{PositionsSPD>DocTypeCode}" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit"/>
<m:Text text="{PositionsSPD>Intpodnum}" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit"/>
<m:Text text="{PositionsSPD>Extcnum}" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit"/>
</m:cells>
</m:ColumnListItem>
</m:items>
In method that work after button click I have an array with the test data:
var PositionsSPD = this.getView().getModel("PositionsSPD");
var oPositionsSPDData = PositionsSPD.getData();
console.log(oPositionsSPDData);
var oPositionsItems = oPositionsSPDData.items;
oPositionsSPDData.items[0] = {"DocNumExt": "11111",
"DocDate": "222222",
"Extcnum": "5555",
"DocTypeCode": "33333",
"Intpodnum": "444444"};
oPositionsSPDData.items[1] = {"DocNumExt": "6666",
"DocDate": "77777",
"Extcnum": "8888",
"DocTypeCode": "99999",
"Intpodnum": "0000"};
PositionsSPD.setData(oPositionsSPDData);
console.log(oPositionsSPDData);
console.log(PositionsSPD.getData());
However, after click the button the data does not appear in the table. In console I get my array. He is ok. refresh() does not help.
When I put the test data in method init() my table is filled.
Why? How can I fill the table after a buton click?
Thanks!