jquery/jquery-mobile — Issue #2791: Expandable not expanded in pageInit, when coming back from other page
Author: mathiaslin
Created: 2011-10-21 05:57:30+00:00
State: open

I have two pages: test1.html, test2.html

The first page, test1.html, includes an collabsible-set, where I expand one collabsible item via script in the pageinit event:

$('#page1').live( 'pageinit', initPage);
function initPage() {
alert('initPage!'); // this line seems to be always getting executed
$('#my_expandable').trigger('expand'); // ... but this line doesn't when coming back via a back link!

}

This works fine on the first call of the page.

Then I have a link that leads me to the second page test2.html, as follows:

page 2

When I then go back to the first page via

test

only the alert message in the pageinit event listener of test1.html is executed, but the collapsible is not being expanded through the

You can see the sample in action here: http://bit.ly/rr0dq3

How to reproduce the problem:
- load test1.html at http://bit.ly/rr0dq3
- you will get an alert message, and the collapsible will be expanded
- click on the button 'GoTo page2' and you will come to the second page test2.html
- on this second page, click on the gray button 'test', and you will come back to the first page test1.html
- the problem now: as you can see, the alert command of the pageinit event of test1.html is being executed, but expanding the collapsible isn't - why not?