cancel
Showing results for 
Search instead for 
Did you mean: 

SegmentedButton doesn't hold the original Ids

0 Kudos

Hi,

In the following code using the sapUI5 "SegmentedButton", when the event "Select" occurs the actual Buttons' Ids are not the original defined ('cc1', 'cc2') but they are the default Ids ('_button14'...).

var columnCharts = new sap.m.SegmentedButton("cc");

var cc1 = new sap.m.SegmentedButtonItem("cc1");

cc1.setIcon('./Content/images/AnalyticsPic1.jpg');

cc1.setWidth('50px');

columnCharts.addItem(cc1);

var cc2 = new sap.m.SegmentedButtonItem("cc2");

cc2.setIcon('./Content/images/AnalyticsPic1.jpg');

cc2.setWidth('50px');

columnCharts.addItem(cc2);

var cc3 = new sap.m.SegmentedButtonItem("cc3");

cc3.setIcon('./Content/images/AnalyticsPic1.jpg');

cc3.setWidth('50px');

columnCharts.addItem(cc3);

columnCharts.placeAt("chartTypeSelector", "only");

columnCharts.attachSelect(function (oEvent) {

     alert("Selected button id: " + oEvent.getParameters().selectedButtonId);

});

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

      var columnCharts = new sap.m.SegmentedButton("cc");

     

var cc1 = new sap.m.SegmentedButtonItem({key : "cc1"});

cc1.setIcon('./Content/images/AnalyticsPic1.jpg');

cc1.setWidth('50px');

columnCharts.addItem(cc1);

      var cc2 = new sap.m.SegmentedButtonItem({key : "cc2" });

cc2.setIcon('./Content/images/AnalyticsPic1.jpg');

cc2.setWidth('50px');

columnCharts.addItem(cc2);

var cc3 = new sap.m.SegmentedButtonItem({key : "cc3"});

cc3.setIcon('./Content/images/AnalyticsPic1.jpg');

cc3.setWidth('50px');

columnCharts.addItem(cc3);

debugger;

columnCharts.placeAt("body", "only");

columnCharts.attachSelect(function (oEvent) {

  debugger;

     alert("Selected button id: " + columnCharts.getSelectedKey());

});

0 Kudos

Thank you !

Answers (1)

Answers (1)

Former Member
0 Kudos