Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

SAPUI5: UI binding with a named model does not work, why?

$
0
0

Hi guys,

 

I have a simple app where on the UI there is a table that is bound to a model. The problem is that once the model is saved in Core with a name, the UI binding does not work. Anyone knows why?  Thanks.

 

Here is the code just using one table on UI:

 

///Model:

var myModel = new sap.ui.model.json.JSONModel();

var myData = {};

myData.ListItems = [{FirstName: "David1", LastName:"Jim1"},{FirstName: "David2", LastName:"Jim2"}];

myData.count = myData.ListItems.length;

myModel.setData(myData);

sap.ui.getCore().setModel(myModel,"myModel1");

 

///View:

var oTable = new sap.ui.table.Table({

       visibleRowCount:"{/count}",

       .....

});

new sap.ui.table.Column({

        new sap.ui.commons.TextView().bindProperty("text", "myModel1>FirstName"),

        .....});

 

oTable.setModel(sap.ui.getCore().getModel("myModel1"));

oTable.bindRows ("myModel1>/ListItems");

 

 

NOTES: when the model is saved in Core without name, it works fine.


Viewing all articles
Browse latest Browse all 6178

Trending Articles