Hi,
I have created a Two Views and also i have created a Two Buttons. And i wrote the Logic for the Button Event Handler in the First View Controller and also in the Second View Controller. But when i try to execute am getting the following Error.
Uncaught TypeError: Cannot read property '0' of undefined
Below the Code:
In the First View:
// Create A Another Button to go to Next View
var button1 = new sap.ui.commons.Button({ text : "Go to View1" ,
press : oController.nextfun });
var arrayfun = [];
arrayfun.push(form);
arrayfun.push(radiobutton);
arrayfun.push(buttono);
arrayfun.push(button1);
return arrayfun;
First View Controller :
next : function()
{
var panelref = sap.ui.getCore( ).byId("mypanel");
var view2ref = sap.ui.getCore( ).byId("idSecond2");
panelref.removeAllContent( );
panelref.addContent(view2ref);
}
In the Second View:
var buttono = new sap.ui.commons.Button({ text : "Back to View1" ,
press : oController.backfun });
var array = [];
array.push(textview);
array.push(fname);
array.push(lname);
array.push(buttono);
return array;
}
Second View Controller:
backfun : function()
{
var panelref = sap.ui.getCore( ).byId("mypanel");
var view1ref = sap.ui.getCore( ).byId("idFirstView1");
panelref.removeAllContent( );
panelref.addContent(view1ref);
}
Kindly Help ....
Regards,
Sadiq K