Can't open popup from select menu. #5254

Closed
kevinbhayes opened this Issue Nov 6, 2012 · 6 comments

Projects

None yet

4 participants

@kevinbhayes

JQM will ignore popup open requests when called from a function bound to a select menu change event.
$("#message-commands").bind("change",function(event,ui) {
var value = event.target.value;
switch(value)
{
case "delete":
$('#myDeletePopup').popup('open');
break;
}
}
does not work. If I put the popup open command in a timeout function, it will work if it is sufficiently long, but the time varies between client devices. There's no way to tell how long to wait for all clients, and I don't want to make it too long the user thinks nothing happens.

If this behaviour isn't supported, then select menus need a "closed" event to bind the command to.

@jaspermdegroot
Member

@kevinbhayes

I suppose this is about a custom select menu. Those are displayed as a popup and chaining popups is not allowed (see last paragraph here http://jquerymobile.com/test/docs/pages/popup/index.html).
The popup fires popupafterclose event so that should resolve your problem.
I am closing this as not a bug. If you still think there is an issue we have to look into, please provide a test page.

@kevinbhayes

popupafterclose seems to fire if you are opening a select from a popup, not opening a popup from a select.

I will build a test page tomorrow.

Kev

On 2012-11-06, at 4:08 PM, Jasper de Groot notifications@github.com wrote:

@kevinbhayes

I suppose this is about a custom select menu. Those are displayed as a popup and chaining popups is not allowed (see last paragraph here http://jquerymobile.com/test/docs/pages/popup/index.html).
The popup fires popupafterclose event so that should resolve your problem.
I am closing this as not a bug. If you still think there is an issue we have to look into, please provide a test page.


Reply to this email directly or view it on GitHub.

@kevinbhayes

Here is the test page. Select "delete using popupafterclose" from the Actions popup to test using the popupafterclose bound event.
http://mirror.parliant.com/jqmbug/selecttest.html

@jerone
Contributor
jerone commented Nov 7, 2012

It is better to a working example on jsFiddle or JS Bin.

http://jsbin.com/iteguk/2/edit

Anyways, confirmed.

@kevinbhayes

So should the status be changed back to open then? Thanks.

FYI, I put the example here: http://jsbin.com/ikudom/1/edit

@jaspermdegroot jaspermdegroot reopened this Nov 8, 2012
@jaspermdegroot
Member

The problem is the selector. $("#message-commands") is not the popup that is created for the selectmenu, but the select element which is still on the page. When changing this to $(".ui-selectmenu") it works:

preview: http://jsbin.com/ikudom/2
code: http://jsbin.com/ikudom/2/edit

@gabrielschulhof - Can we add the id of the select with a suffix/prefix to the popup? Similar to what we do for the popup container. This way we keep unique id's, but people would have a selector to target a specific selectmenu popup.

@kevinbhayes - You had the script in the body and no div[data-role="page"]. This results in two select buttons. See the last paragraph of this page: http://jquerymobile.com/test/docs/pages/page-anatomy.html. In general we recommend to put scripts in the head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment