I have one SplitApp with Master -Detail layout. I would like to know how can I set the first item in Master view to default so that on loading of application Detail view shows the information about the select list item. So when user open the application automatically first item in Master should be selected and Detail View show the information.
I am using Objectlist Item as control for Master view. And currently using the select event for selecting the list item.
var oList = new sap.m.List("idMasterList",{
mode: sap.m.ListMode.SingleSelect,
select: [oController.onSelectItem, oController]
});
onSelectItem: function(oEvent){
//var app = sap.ui.getCore().byId("splitApp");
var oMasterList = sap.ui.getCore().byId("idMasterList");
var oSelItem = oMasterList.getSelectedItem();
var sPath = oSelItem.oBindingContexts.druginfo.sPath;
var oItem = sap.ui.getCore().getModel("druginfo").getProperty(sPath);
var oSelModel = new sap.ui.model.json.JSONModel(oItem) ;
sap.ui.getCore().setModel(oSelModel, "SelectedItem");
}
Regards, Mayank