cancel
Showing results for 
Search instead for 
Did you mean: 

IconTabBar doesn't fire the Select event

0 Kudos

Hello experts,

I created the IconTabBar that holds IconTabFilter items. The event select should fire the event when the item is selected.
I wrote the simple function that should be executed and show the Message "Hello". But after selecting the item doesn't do anything, so I can't even see what the issue is in a debugger.

var Bar_xx = new sap.m.IconTabBar("IconTabBarxx", {
expandable: false,
expanded: false,
applyContentPadding: true,
stretchContentHeight: false,
select: function OEvent(oEvent) {
var sId = oEvent.getSource().getId();
if(sId === "Icon1") {
showMessages("Hello");

items: [
new sap.m.IconTabFilter("Icon1", {
text: "All",
key: "All",
}),

Thank you,

Best regards,

Nikita

Accepted Solutions (0)

Answers (1)

Answers (1)

gichuhimd
Explorer
0 Kudos

What if you assign unique keys to each of the IconTabFilter. Then use the keys instead of the ID. Assume the keys are a, b,c and d for 4 IconTabFilters:

select: function(oEvent){
var key = oEvent.getSource().getSelectedKey();
if(key=="a"){
showMessages("Hello");
//MessageToast.show("Hello");
}else if(key=="b"){
bla bla...
}
}
0 Kudos

I tried to implement it with keys but it still doesn’t work.

Wojciech_P
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

you can try use:

var key = oEvent.getParameter("selectedKey")

instead of var key = oEvent.getSource().getSelectedKey();

Best Regards

Fjaoos
Participant
0 Kudos

Hi,

why do you have it written like this: function OEvent(oEvent) ?

I think it should be without OEvent.