on 07-13-2015 8:56 AM
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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Bhawna,
what object are you using for dropdown?
Rgds,
Dominik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
well, when you select value from first, check how many records are in second and if it is 1, show popup right away 😉
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.