New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't open popup from select menu. #5254

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

Comments

Projects
None yet
4 participants
@kevinbhayes

kevinbhayes commented Nov 6, 2012

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

This comment has been minimized.

Show comment
Hide comment
@jaspermdegroot

jaspermdegroot Nov 6, 2012

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.

Member

jaspermdegroot commented Nov 6, 2012

@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

This comment has been minimized.

Show comment
Hide comment
@kevinbhayes

kevinbhayes Nov 6, 2012

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 commented Nov 6, 2012

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

This comment has been minimized.

Show comment
Hide comment
@kevinbhayes

kevinbhayes Nov 7, 2012

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

kevinbhayes commented Nov 7, 2012

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

This comment has been minimized.

Show comment
Hide comment
@jerone

jerone Nov 7, 2012

Contributor

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

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

Anyways, confirmed.

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

This comment has been minimized.

Show comment
Hide comment
@kevinbhayes

kevinbhayes Nov 8, 2012

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

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

kevinbhayes commented Nov 8, 2012

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

This comment has been minimized.

Show comment
Hide comment
@jaspermdegroot

jaspermdegroot Nov 9, 2012

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.

Member

jaspermdegroot commented Nov 9, 2012

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