Skip to Content
-1

I want to create a dialog box on press of a button in controller and bind the data.

May 09, 2017 at 09:23 AM

22

avatar image
Former Member

basically a table have a view button on click of it , it should fetch the event id of the row and display the title and description from backed system .

i have written the flowing code in the controller part on the press function of the view button but i am not able to fetch any data please help.

onView: function(oEvent) {

//identifing the selected rows event id

var otable = this.byId("idTableNotifiation");

var path = oEvent.getSource().getParent() .getBindingContext().getPath();

var selectedRow = otable.getModel().getProperty(path);

var oEventID = selectedRow.EventID;

// contents of the dialog box

var oLabelTitle = new sap.m.Label({ text: "{TitleStory}",

design: "Bold", }).addStyleClass("title");

var oFlexboxTitle = new sap.m.FlexBox({ height:"40px", alignItems:"Start", justifyContent:"Center", alignContent: "Stretch" , items: [oLabelTitle]});

var oLabelDescription = new sap.m.Text({ text: "DESCRIPTION:", design: "Bold", });

var oTextDescription = new sap.m.Label({ text: "{NContent}", });

var oVboxContent = new sap.m.VBox({ items: [ oLabelDescription,oTextDescription] });

var oBtnBack = new sap.m.Button({ text : "Close", icon : "sap-icon://back", press : function(){ oDialog1.close(); oDialog1.destroy(); } })

var oVboxCreateLayout = new sap.m.VBox({ width:"100%", items: [oFlexboxTitle,oVboxContent] });

var oDialog1 = new sap.m.Dialog({ title: "View Notification",

//content : [oVerticalLayou]

});

oDialog1.bindElement("/NotificationCollection('" + oEventID + "')"); oDialog1.addContent(oVboxCreateLayout) oDialog1.addButton(oBtnBack);

oDialog1.open(); },

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers