Hi Michael,
I tried your code and it shows alert Dialog on Startup
//View.js
createContent : function(oController) {
this.openDialog();
var oShell = new sap.ui.ux3.Shell("myShell", {
//appIcon : "http://www.sap.com/global/images/SAPLogo.gif",
appTitle : "GL Account List In Chart of Accounts",
showLogoutButton: true,
showSearchTool: false,
showFeederTool: false,
showInspectorTool: false,
designType: sap.ui.ux3.ShellDesignType.Light
//headerItems: headerItems
//headerItems: [new sap.ui.commons.TextView({text:"FIHANA",tooltip:"User Name"})]
//worksetItems: [new sap.ui.ux3.NavigationItem("WI_home",{key:"wi_home",text:"Home"})]
});
oShell.placeAt("content");
},
openDialog : function(){
alert("Open Dialog on startup");
}
//Controller.js
});
onInit: function(oEvent) {
},
But when I changed the Dialog function coding and added input parameters, I got the below error on console
openDialog : function(){
var layoutNew = new sap.ui.commons.layout.MatrixLayout("layout1", {width:"auto"});
var oVal1 = new sap.ui.commons.TextField("cArea",{tooltip: "Controlling Area", width: "200px", editable:true});
var oVal2 = new sap.ui.commons.TextField("sDate",{tooltip: "Start Date", width: "200px", editable:true});
var oVal3 = new sap.ui.commons.TextField("eDate",{tooltip: "End Date", width: "200px", editable:true});
var oVal4 = new sap.ui.commons.TextField("isRead",{tooltip: "Is Read", width: "200px", editable:true});
var oExcButton = new sap.ui.commons.Button({
text : "Submit",press:function(){
//var oLabel = new sap.ui.commons.Label("l1");
//oLabel.setText(CArea);
oDialog1.close();}});
//press : oController.callOdataService });
layoutNew.createRow(new sap.ui.commons.Label({text: "Controlling Area: "}), oVal1 );
layoutNew.createRow(new sap.ui.commons.Label({text: "Start Date: "}), oVal2 );
layoutNew.createRow(new sap.ui.commons.Label({text: "End Date: "}), oVal3 );
layoutNew.createRow(new sap.ui.commons.Label({text: "Is Read: "}), oVal4 );
layoutNew.createRow(new sap.ui.commons.Label(),oExcButton);
var oDialog1 = new sap.ui.commons.Dialog();
oDialog1.setTitle("Enter Input Parameters");
oDialog1.setShowCloseButton();
oDialog1.addContent(layoutNew);
oDialog1.open();
}
Error:
Uncaught Error: Core must be initialized sap-ui-core.js:141
sap.ui.core.Core.getCurrentFocusedControlId sap-ui-core.js:141
(anonymous function) sap-ui-core.js:117
sap.ui.core.Popup.getCurrentFocusInfo Popup.js:25
sap.ui.commons.Dialog.open Dialog.js:11
sap.ui.jsview.openDialog Test.view.js:396
sap.ui.jsview.createContent Test.view.js:17
(anonymous function) JSView.js:6
sap.ui.base.ManagedObject.runWithPreprocessors sap-ui-core.js:117
sap.ui.core.mvc.JSView.onControllerConnected JSView.js:6
sap.ui.core.mvc.View._initCompositeSupport View.js:6
sap.ui.base.EventProvider.extend.constructor sap-ui-core.js:117
sap.ui.base.ManagedObject.extend.constructor sap-ui-core.js:117
sap.ui.core.Element.extend.constructor sap-ui-core.js:117
f sap-ui-core.js:117
f sap-ui-core.js:117
o sap-ui-core.js:117
sap.ui.view View.js:6
o.(anonymous function) sap-ui-core.js:117
(anonymous function)