ajax替换数据主题但触发器('create')或listview('refresh')不起作用

时间:2013-01-18 22:04:19

标签: jquery ajax mobile data-theme

问候,

我正在尝试替换数据主题但从未对trigger.('create')listview('refresh')

应用更改

请在JSFIDDLE

测试我的代码

感谢您的帮助

这是我的代码......

HTML:

<div data-role="page" id="home">
  <div data-role="content">
    <div>
      <ul id="uuu" data-role="listview">
        <li id="kkk" data-theme="e">fail change to theme A</li>
      </ul>
    </div>
  </div>
</div>

JavaScript:

$('#uuu').append('<li data-theme="a">success change to theme A</li>');

$('#kkk').attr('data-theme', 'a');  // I need do this through ajax

// ======

$('#home').trigger('create');
$("#uuu").listview("refresh");
$("#kkk").listview("refresh"); // this is not working ?

1 个答案:

答案 0 :(得分:0)

您需要刷新ul:

$("#uuu").listview("refresh")

了解更多信息:http://jquerymobile.com/demos/1.2.0/docs/lists/lists-methods.html 1