cancel
Showing results for 
Search instead for 
Did you mean: 

DROPDOWN ISSUE

Former Member
0 Kudos

Hi,

I have created two dropdowns.On selection of value in first ,second dropdown gets its values.On selecting any value of second dropdown ,popup window opens but the problem is if the value in second dropdown that came from first dropdown is only one ,then no popup appears as I have put the change event.What should be the alternative?

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Main problem is if I try to open the popup with the same selected value then its not opening.Only if I change my selection it works.What could be the possible solution.Thanks

Qualiture
Active Contributor
0 Kudos

already gave you the solution to your query in the very first comment, have you seen it?

In other words, the popup should not open at the change event of the selected 2nd dropdown, but also after the data for that 2nd dropdown is loaded and it only contains 1 item

Former Member
0 Kudos

yes robin but my problem is: when I select a value in dropdown,popup opens.But if I close the dropdown and try to open the popup with the same selected value then it doesnot get opened.Please guide me for the same

Former Member
0 Kudos

That might be because you open the popup in the change event of the dropdown (is it sap.m.Select?). If you select the same entry again, it is obious that the event won't be called.

I suggest to add a button, which then will open the popup in its press event.

Former Member
0 Kudos

no that's not my scenario is 1st dropdown on click of which buuton.won click of which another dropdown and on click of its value,popup appears

Qualiture
Active Contributor
0 Kudos

But it is really strange to 'click' a dropdown and without selecting anything -- or selecting the same selection -- to have an action attached.

A much better solution would be to -- if you close the popup -- have the 2nd dropdown reset to a first, empty item. That way you must always make a new selection which triggers your popup to be opened

Former Member
0 Kudos

thanks .How can I reset the values of a dropdown after closing popup window.

Qualiture
Active Contributor
0 Kudos

Add an empty item to your second dropdown when you finish loading the data for the second dropdown:


oModel.attachRequestCompleted(function (oEvent) {

    that.byId("mySelect").insertItem(new sap.ui.core.Item({key : "", text: "<none>"}), -1);

});

Then, in the close event handler of your popup, set the selected index of your 2nd dropdown to the first (empty) item.

It really is that simple

agentry_src
Active Contributor
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.


Thanks, Mike (Moderator)
SAP Technology RIG

antonette_oberholster
Active Contributor
0 Kudos

Hallo Bhawna

Hide/disable the second dropdown untill the first dropdown has a selection.

In the first dropdown on change event: populate the second dropdown with values from the odata service and then enable/show the second dropdown.

This forces the user to use the first dropdown.

regards

Antonette

Former Member
0 Kudos

Mian problem is If I try  to open the popup with the same selected value in dropdown then its not working.Please guide through the same

former_member187439
Active Participant
0 Kudos

Use the "Place holder" property with a text like "Select a value". So that the user is forced to use the select from drop down.

(or)

Try to add an additional empty value (" " - just a space) in your second drop down in addition to the actual values in such a way that this is the first in your list. On your "Change event", write a condition to open the pop up - that is, open pop up only if the selected value is not empty/ space.

Former Member
0 Kudos

(or)

add an event to the odata call. When the odata call is successful and it is only returning one value, you can directly open the dialog or trigger the change event of the dropdown.

Former Member
0 Kudos

Hello Bhawna,

what object are you using for dropdown?

Rgds,

Dominik

Former Member
0 Kudos

object as in?

former_member182372
Active Contributor
0 Kudos

well, when you select value from first, check how many records are in second  and if it is 1, show popup right away 😉

Qualiture
Active Contributor
0 Kudos

The only right answer

Former Member
0 Kudos

Data in second dropdown is cuming from backend.I tried using click and select event but it didn't work

former_member182372
Active Contributor
0 Kudos

dude, be careful with your sloppy typing, it is turning somewhere wrong

data might come even from outer space, but it comes to your app, in which you have full control