For some reason, I am struggling to understand why this issue is occurring: In jQuery Mobile, I have an unordered list with data-inset="true"
. Initially, it displays perfectly with rounded top and bottom edges. However, on dynamically adding new elements to the list and calling listview('refresh')
, it no longer appears as an inset list.
Update: This problem only arises when invoking listview('refresh');
on a list that is not on the currently active page. When navigating to the page containing the list, the listview updates with all necessary styles for an inset list except for the rounded corners at the top and bottom. To replicate this issue, refer to this link: http://jsfiddle.net/94X7S/10/
Below is the HTML structure of the list before executing .listview('refresh');
<ul data-role="listview" data-inset="true" data-theme="c" data-divider-theme="b" class="ui-listview ui-listview-inset ui-corner-all ui-shadow">
<li data-role="list-divider" role="heading" class="ui-li ui-li-divider ui-btn ui-bar-b ui-corner-top ui-btn-up-undefined">
User Reviews (4) <span class="rate"><img src="..." alt="Rating"/></span>
</li>
<li data-theme="c" class="ui-btn ui-btn-up-c ui-btn-icon-right ui-li-has-arrow ui-li">
<div class="ui-btn-inner ui-li" aria-hidden="true">
<div class="ui-btn-text">
<a href="#reviews" class="ui-link-inherit">
<h3 class="ui-li-heading"><img src="..." alt="Rating"/>Review Title</h3>
<p class="ui-li-desc">Review Content...</p>
</a>
</div>
<span class="ui-icon ui-icon-arrow-r ui-icon-shadow"/>
</div>
</li>
<li data-theme="c" class="ui-btn ui-btn-up-c ui-btn-icon-right ui-li-has-arrow ui-li ui-corner-bottom">
<div class="ui-btn-inner ui-li" aria-hidden="true">
<div class="ui-btn-text">
<a href="#reviews" class="ui-link-inherit">
<h3 class="ui-li-heading"><img src="..." alt="Rating"/>Review Title</h3>
<p class="ui-li-desc">Review Content...</p>
</a>
</div>
<span class="ui-icon ui-icon-arrow-r ui-icon-shadow"/>
</div>
</li>
</ul>
Here is how the list's HTML changes after invoking .listview('refresh');
<
ul data-role="listview" data-inset="true" data-theme="c" data-divider-theme="b" class="ui-listview ui-listview-inset ui-corner-all ui-shadow">
<li data-role="list-divider" role="heading" class="ui-li ui-li-divider ui-btn ui-bar-b">
User Reviews (4) <span class="rate"><img src="..." alt="Rating"/></span>
</li>
<li data-theme="c" class="ui-btn ui-btn-up-c ui-btn-icon-right ui-li-has-arrow ui-li">
<div class="ui-btn-inner ui-li" aria-hidden="true">
<div class="ui-btn-text">
<a href="#reviews" class="ui-link-inherit">
<h3 class="ui-li-heading"><img src="..." alt="Rating"/>Review Title</h3>
<p class="ui-li-desc">Review Content...</p>
</a>
</div>
<span class="ui-icon ui-icon-arrow-r ui-icon-shadow"/>
</div>
</li>
<li data-theme="c" class="ui-btn ui-btn-up-c ui-btn-icon-right ui-li-has-arrow ui-li">
<div class="ui-btn-inner ui-li" aria-hidden="true">
<div class="ui-btn-text">
<a href="#reviews" class="ui-link-inherit">
<h3 class="ui-li-heading"><img src="..." alt="Rating"/>Review Title</h3>
<p class="ui-li-desc">Review Content...</p>
</a>
</div>
<span class="ui-icon ui-icon-arrow-r ui-icon-shadow"/>
</div>
</li>
</ul>
It's evident that some classes are missing from the first and last <li>
tags post-listview('refresh');
. Is there any specific reason behind this or any solution to avoid such issues? Any suggestions would be highly valued.