cancel
Showing results for 
Search instead for 
Did you mean: 

Get the key automatically on first load of IconTabBar.

Gautam_M
Participant
0 Kudos

Hello Experts,

I am trying to get the first IconTabBar container populated automatically on load of page. Since I am loading the data by passing the key of Icontabfilter in model so I am unable to load the container under first tab.

Please help me out.

Thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hi,

PFA

In View.xml:

<IconTabBar id="itb" expanded="{device>/isNoPhone}" select="handleTabSelect">

<items>

<IconTabFilter icon="sap-icon://employee" text="Personal Info" iconColor="Neutral" id="details" key="details" >

-------------

</IconTabFilter>

</items>

< /IconTabBar>

In controller.js:

onInit: function() {

this.getView().byId("details").setSelectedKey("details");

}

Regards,

Asha

Gautam_M
Participant
0 Kudos

Thanks Asha for your quick response. My key is dynamic as it is binded to a model so can you please suggest an alternate for this.

0 Kudos

Hi,

In controller.js:

var oData = data.results;

var oModel = new sap.ui.model.json.JSONModel();

oModel.setData(oData,"NamedModel");

for(i=0;i<oData.length;i++){

var LData = oData[i].des;

var oKey = this.getView().byId("detail").getSelectedKey();

Here Dynamically you can set Text

if(oKey == "detail"){

this.getView().byId("detail").setText("")

}

}

Thanks,

asha

0 Kudos

Instead of "detail" in if condition u need to use LData

Gautam_M
Participant
0 Kudos

No Luck here.