cancel
Showing results for 
Search instead for 
Did you mean: 

Panel Click

Former Member
0 Kudos

Hi All,

I have created a panel and shows up corrrectly.

What i want is ability to click on Panel and alert box shows up. But this is not happening.

I need user's to click on this and get an alert.

Code:

var L3ST70 = new sap.ui.commons.Panel("L3ST70",{applyContentPadding: true, width: "120px", height: "130px", showCollapseIcon: false,

click: function(){alert("clicked");}

});

Regards.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182862
Active Contributor
0 Kudos

Hi Asif

You have to extend the Panel control like this

JS Bin - Collaborative JavaScript Debugging

Former Member
0 Kudos

I have extended the panel with press event, it is not working :

the code is below :

sap.ui.commons.Panel.extend("StationPanel", {

   metadata: {

   events: {

   "press" : {} 
   }

  },


   onmousepress : function(evt) { 
   this.firePress();

  },

   renderer: {}
});

var L3ST70 = new StationPanel("L3ST70",{applyContentPadding: true, width: "120px", height: "130px",showCollapseIcon: false,

   press: function(evt) {

   alert("Button " + evt.getSource().getId() + " was hovered.");

  }

});

But if i use hover it works.

please advise what to do with this code.

Former Member
0 Kudos

i have resolved it myself with following code:

sap.ui.commons.Panel.extend("StationPanel", {

   metadata: {

   events: {

   "press" : {} 
   }

  },


   onmouseup : function(evt) { 

   this.firePress();

  },

   renderer: {}
});

var L3ST70 = new StationPanel("L3ST70",{applyContentPadding: true, width: "120px",height: "130px",showCollapseIcon: false,

   press: function(evt) {

   alert("Button " + evt.getSource().getId() + " was hovered.");

  }

});

Answers (0)