Skip to Content
0
Former Member
Feb 26, 2014 at 05:21 AM

BindAggregation After The Control Is Already Created

20 Views

I would like to create a listBox (an empty one), and then later bind it to data to populate the list Items.

Assume that I have already created an empty list box called _oSourceListBox

Now I want to do the below:

populateSourceData:function()

{

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

oModel.setData(_dataProvider);

_oSourceListBox.setModel(oModel);

var oItemTemplate = new sap.ui.core.ListItem({text:"{value}"});

_oSourceListBox.setItems({path: "/fruits",template: oItemTemplate});

}

I am not able to get this to work. What is the correct way of bindAggregating after the control is already created. I can do it while creation of control but I do not want that as the data is available only later.

Appreciate your help.

Thanks

Amjad