简体   繁体   English

jQuery Mobile-刷新时的ListView数据插入

[英]jQuery Mobile - listview data-inset on refresh

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" 
          href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
    <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
    <script> 
       $("#local").live('pageinit', function(evt) {
           //$(document).ready(function(){
           var edit = $('#edit');
           edit.append('<li>test1</li>');
           edit.listview('refresh');
       });
    </script>
</head>
<body>

 <div data-role="page" id="index">
   <div data-role="content">
     <ul data-role="listview" data-inset="true">
       <li>
         <a href="#local">
           <h3 class="ui-li-heading">Local Storage Test</h3>
           <p class="ui-li-desc">Just a test</p>
         </a>
       </li>
     </ul>
   </div> 
 </div>

 <div data-role="page" data-add-back-btn="true" id="local">
   <div data-role="content">
     <ul id="edit" data-role="listview" data-inset="true">
       <li>ntry already there. Append works...</li>
     </ul>
   </div>
 </div>
</body>
</html> 

So my problem is on the second page. 所以我的问题在第二页上。 I just added a new element and update the list view just to load the css jqm. 我刚刚添加了一个新元素并更新了列表视图,以仅加载css jqm。 But if I use everything that is good pageInit except round the corners of the list view (data frame = "true"). 但是,如果我使用一切都很好的pageInit,除了绕过列表视图的角落(数据框=“ true”)。 He did not appear rounded, but I checked the css load, and should be all year. 他没有出现四舍五入的情况,但是我检查了CSS负载,应该是整年。 But when used document.ready everything is fine. 但是当使用document.ready时,一切都很好。 Round the corners of the list view! 圆角列表视图! Please help me because I do not want to use document.ready. 请帮助我,因为我不想使用document.ready。

 $("#local").live('pagecreate', function (evt) { 
   var edit = $('#edit');
   edit.append($('<li>test1</li>')) 
 });

Try replacing above code peace 尝试替换上面的代码和平

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM