ChristianR
ChristianR

Reputation: 77

SAPUI5 IconTabBar get selection before and after user interaction

I have a XML View with a SAPUI5 <IconTabBar>which is connected to an event handler method. It looks like that:

<IconTabBar id="ITB1" select="onSelect">
  <items>
    <IconTabFilter id="ITF1" text="{i18n>textITF1}" icon="sap-icon://area-chart"/>
    <IconTabFilter id="ITF2" text="{i18n>textITF2}" icon="sap-icon://area-chart"/>
    <IconTabFilter id="ITF3" text="{i18n>textITF3}" icon="sap-icon://area-chart"/>
  </items>
</IconTabBar>

Now I want to check in the function

onSelect 

what was selected before the user "click" and after the user "click". F.ex. first ITF1 was selected and now ITF2 is selected. Based on the last selected IconTabFilter I want to do a different handling.

My problem is that in the onSelect function the selected item is already updated and so I do not know what was selected before the user interaction.

Is there a way to get the selected item before it is changed in the IconTabBar control?

With best regards ChristianR

Upvotes: 0

Views: 1557

Answers (1)

iPirat
iPirat

Reputation: 2206

No, there is no parameter in the event, which tells you the previous state. You could store it yourself

_previousIFT: 'IFT1',
 onSelect: function(oEvent) {
      var oPrevIFT = this.getView().byId(this._previousIFT);
     // do something with oPrevIFT and new IFT from event
      // store the Id of the new IFT from event into this._previousIFT
 }

Upvotes: 0

Related Questions