Refresh listivew
Description
The following code shows how to refresh listivew.
Example
<!DOCTYPE html>
<html>
<head>
<title>- jsFiddle demo by giofiddle</title>
<script type='text/javascript'>//<![CDATA[
window.onload=function(){<!--from w ww.j a va2s . c om-->
var count = 1;
$('#add1').click(function() {
$('#1, #2').append('<li>' + count + '</li>');
$("ul").listview('refresh');
count++;
});
$('#add2').click(function() {
$('#1, #2').append('<li>' + count + '</li>');
$("ul").listview('refresh',true);
count++;
});
}//]]>
</script>
</head>
<body>
<link rel="stylesheet"
href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script
src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
<div id="page1" data-role="page">
<div data-role="content">
<a id="add1" href="#">Add + refresh</a><br>
<a id="add2" href="#">Add + refresh, true</a>
<ul id="1" data-inset="true" data-role="listview">
<li data-role="list-divider">List 1</li>
</ul>
<div data-role="collapsible">
<h3>Collapsible</h3>
<ul id="2" data-inset="true" data-role="listview">
<li data-role="list-divider">List 2</li>
</ul>
</div>
</div>
</div>
</body>
</html>