I have sap.m.List with sap.m.StandardListItem within oDialog. When user opens oDialog, model is being set with main category list. Item press sets second model with child items, but List control showing blank items, first model is still set as default. What I'm doing wrong?
My code (oList):
var oList = new sap.m.List({
mode: "SingleSelectMaster",
templateShareable: false,
includeItemInSelection: true,
itemPress: function (oEvent) {
var sPath = oList.getSelectedItem().getBindingContext().sPath.substr(1);
var sListID = oList.getId();
var model = oList.getModel().getData();
console.log("model current (press): ", model);
//check item type
var sItemType = oList.getSelectedItem().mProperties.type;
if (sItemType == "Active") {
//do somtehing
}
//new model - child items
var sURL = '/XMII/Runner?Transaction=Project/trasnaction¶m1=' + param1;
var oModel3 = new sap.ui.model.xml.XMLModel();
oModel3.loadData(sURL,"Model" + sPath, false);
oList.setModel(oModel3, "Model" + sPath);
oList.setBindingContext(new sap.ui.model.Context(oModel3, "Model" + sPath + ">/serviceInvocationResponse/responses"));
oList.bindItems({
path: "/",
templateShareable: false,
template: oTemplate
});
var newData = oList.getModel("Model" + sPath).getProperty("/"); //showing correct data from new model
console.log("newData: ", newData);
if (sItemType == "Navigation") {
//do somtehing
}
}
});
I'm using SAP UI5 ver. 1.44.46
Thanks in advance!