cancel
Showing results for 
Search instead for 
Did you mean: 

how to get a different view according to selected item from the combo box ?

virendra_soni2
Participant
0 Kudos

In my combo box i have 3 option and i need to change the view according to the selected item from the combo box.

thanks,

virendra soni

Accepted Solutions (1)

Accepted Solutions (1)

seVladimirs
Active Contributor
0 Kudos

You can do that with Nav Container, more details regarding Nav Container - SAPUI5 Explored

JSbin Example: JS Bin - Collaborative JavaScript Debugging

virendra_soni2
Participant
0 Kudos

Hi Vladimirs

  I am trying to hide some page elements based on the item selected from the combo box. For this i need to write multiple if statements based on the id of the selected item. Can you please give me a clue on how to proceed with this approach.

Regards,

Virendra Soni

saivellanki
Active Contributor
0 Kudos

Hi Virendra,

You mean something like this? Plunker


If you click on First Button, you will get an alert to select Second/Third Button.

If you click on Second Button,it will navigate to second page which consists of three columns in table (With Availability column Visible).

If you click on Third Button, it will navigate to second page which consists of two columns in table (With Availability column Invisible).


Instead of Button press, you have to use the selectionChange event of the combo box to catch the item selected, everything else logic remains same.

Regards,

Sai Vellanki.

virendra_soni2
Participant
0 Kudos

Hi Sai

I am trying to hide some page elements based on the item selected from the combo box. For this i need to write multiple if statements based on the id of the selected item. Can you please give me a clue on how to proceed with this approach.

Regards,

Virendra Soni

virendra_soni2
Participant
0 Kudos

yes i am using the selectionChange event of the combo box but how do i write multiple if statements to capture which item was selected

Former Member
0 Kudos

hi,

In selectionChange event u can get the key of the selected item through oevent.getSource().getSelectedKey().

After getting the selected key use if contions logic for your navigation.

Jagadeesh.

saivellanki
Active Contributor
0 Kudos

Hi Virendra,

You can get the selected Item Text/Key value like this -


selectionChange: function(oEvent){

var oKey = oEvent.getParameter("selectedItem").getKey();

var oText = oEvent.getParameter("selectedItem").getText();

}

Then depending on the value, you can handle if else logic.

Regards,

Sai Vellanki.

Answers (1)

Answers (1)

virendra_soni2
Participant
0 Kudos

THANK YOU ..Sai Vellanki AND Vladimirs Semikins .

I got my Answer from Your side.....

0 Kudos

Please mark this Discussion with a Correct Answer (closes, but does not lock the Discussion) and Helpful Answer where appropriate. See http://scn.sap.com/community/support/blog/2013/04/03/how-to-close-a-discussion-and-why   Even if you discovered the solution without any outside contributions, it helps others to understand what the solution turned out to be. 

Do not use Assumed Answered as it confuses anyone looking for the specific answer.  If you dig into the Getting Started link (top right of each SCN page), you are only instructed to mark Helpful or Correct Answers to Discussion responses. 

Thanks, Mike (Moderator)

SAP Technology RIG