Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the lifetime of a jQuery Mobile Widget?
    primarykey
    data
    text
    <p>I have an issue with the jQuery Mobile 1.3.1 table widget which I think is related to widget lifetime.</p> <p>I'm using the table widget in columntoggle mode in a page. On first use of the page there are no issues. If I then navigate around my site (without refreshing the browser window) and then go back to the page there seem to be two instances of the widget hanging around. The older one raises an error if I try and resize the page, I think because it's attempting to manipulate elements that were unloaded.</p> <p>Example code is below and published in this fiddle: <a href="http://jsfiddle.net/cjindustries/thqga/" rel="nofollow">http://jsfiddle.net/cjindustries/thqga/</a> (Navigate to page 2, then resize the browser. The removal of the elements emulates JQM unloading the page.).</p> <p>Can anyone explain to me how jQuery Mobile manages widgets in general and if/how I need to actively destroy widgets in this scenario?</p> <p>Thanks, Chris.</p> <pre><code>&lt;div id="p1" data-role="page"&gt; &lt;table data-role="table" id="table1" data-mode="columntoggle" class="ui-responsive table-stroke"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th data-priority="2"&gt;Rank&lt;/th&gt; &lt;th&gt;Movie Title&lt;/th&gt; &lt;th data-priority="3"&gt;Year&lt;/th&gt; &lt;th data-priority="1"&gt;&lt;abbr title="Rotten Tomato Rating"&gt;Rating&lt;/abbr&gt;&lt;/th&gt; &lt;th data-priority="5"&gt;Reviews&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;th&gt;1&lt;/th&gt; &lt;td&gt;&lt;a href="http://en.wikipedia.org/wiki/Citizen_Kane" data-rel="external"&gt;Citizen Kane&lt;/a&gt;&lt;/td&gt; &lt;td&gt;1941&lt;/td&gt; &lt;td&gt;100%&lt;/td&gt; &lt;td&gt;74&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;a href="#p2" data-role="button"&gt;Page 2&lt;/a&gt; &lt;/div&gt; &lt;div id="p2" data-role="page"&gt; &lt;table data-role="table" id="table2" data-mode="columntoggle" class="ui-responsive table-stroke"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th data-priority="2"&gt;Rank&lt;/th&gt; &lt;th&gt;Movie Title&lt;/th&gt; &lt;th data-priority="3"&gt;Year&lt;/th&gt; &lt;th data-priority="1"&gt;&lt;abbr title="Rotten Tomato Rating"&gt;Rating&lt;/abbr&gt;&lt;/th&gt; &lt;th data-priority="5"&gt;Reviews&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;th&gt;7&lt;/th&gt; &lt;td&gt;&lt;a href="http://en.wikipedia.org/wiki/The_Graduate" data-rel="external"&gt;The Graduate&lt;/a&gt;&lt;/td&gt; &lt;td&gt;1967&lt;/td&gt; &lt;td&gt;91%&lt;/td&gt; &lt;td&gt;122&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;a href="#p1" data-role="button"&gt;Page 1&lt;/a&gt; &lt;/div&gt; $(document).on('pageshow', '#p2', function () { $('#p1').html(''); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload