语言

Menu
Sites
Language
What actions should I perform to re-render controls?
​I have a JS code that places content into `<ul>` tag. When I tried to place a similar HTML-snippet everything worked fine. Now I'm putting it with javascript and UI breaks down and looks really ugly. In jQueryMobile I used `$('#listboxID').listbox('refresh')` to re-render `<ul>`. But I'm not using jQM in project so how can I do that?

Here's the scripts I'm adding into HTML page:

<head>
<script src="tizen-web-ui-fw/latest/js/jquery.min.js"></script>
<script src="./js/config.js"></script>
<script src="tizen-web-ui-fw/latest/js/tizen-web-ui-fw-libs.min.js"></script>
<script src="tizen-web-ui-fw/latest/js/tizen-web-ui-fw.min.js"
  data-framework-theme="tizen-white"
  data-framework-viewport-scale="false"></script>
<script type="text/javascript" src="./js/main.js"></script>
</head>​

And here's the HTML markup (just in case):

<div data-role="content">
  <ul data-role="listview" id="personList">
    <!-- <li class="ui-li-multiline"> this is the snippet I'm using
      <a href="#">
        <span class="person-box">
          <span class="avatar-box"></span>
          <span class="name-box">FirstName LastName</span>
        </span>
      </a>
    </li> -->
  </ul>
</div>
编辑者为: Brock Boland 17 3月, 2014 原因: Paragraph tags added automatically from tizen_format_fix module.

响应

6 回复
talari praveen kumar
Hi Try this $("#personList").append(item).trigger("create").listview( ); here 'item' is the content you want to add to the <ul> tag
Yusup Abdullaev
It helped partially, but
  • elements stayed in the same broken way. Any thoughts or may you provide me a link so I can study this problem?
  • konduri sai swathi
    Hi, Try the below code :
    var string='
      '; for(var i = 0; i < 10; i++) { string+='
    • ' +'' +i +'
    • '; } string+= '
    '; $("#content").append(string).trigger("create").listview( );
    konduri sai swathi
    var string='<ul id="list_items" data-role="listview">'; for(var i = 0; i < 10; i++) { string+='<li>' +'<a>' +i +'</a></li>'; } string+= '</ul>'; $("#content").append(string).trigger("create").listview( );
    Yusup Abdullaev
    With help of konduri sai swathi this code worked: $('#personList').trigger('create').listview('refresh')
    Maksym

    What about more complex elements?

    For instance: popup dinammicaly attached to the current page, and this popup has buttons, listview, etc. inside
    ?