jQuery Mobile的列表视图(“刷新”)未完成的增强 [英] jQuery mobile listview('refresh') doesn't complete enhancement

查看:91
本文介绍了jQuery Mobile的列表视图(“刷新”)未完成的增强的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列表视图,均能显示。我添加项目到它,使用我习惯把原来的项目中它具有完全相同的功能。如果我没有刷新列表视图,新项目没有得到增强(不足为奇)。但是当我做致电刷新,增强是不完整的。

I have a listview, all nicely displayed. I add an item to it, using the exact same function I used to put the original items in it with. If I don't refresh the listview, the new item doesn't get enhanced (no surprise there). But when I DO call refresh, the enhancement is incomplete.

下面是为进入项目:

<li data-role="fieldcontain" id="flip-li-38">
  <div class="containing-element">
    <label for="flip-38">A B:</label>
    <select name="flip-38" id="flip-38" data-role="slider" data-mini="true">
      <option value="off">Absent</option>
      <option value="on">Present</option>
    </select>
  </div>
</li>

下面是该项目增强后:

<li data-role="fieldcontain" id="flip-li-38" class="ui-li ui-li-static ui-body-c">
  <div class="containing-element">
    <label for="flip-38">A B:</label>
    <select name="flip-38" id="flip-38" data-role="slider" data-mini="true">
      <option value="off">Absent</option>
      <option value="on">Present</option>
    </select>
  </div>
</li>

但这里原本在列表中的项目之一:

But here's one of the items originally in the list:

<li data-role="fieldcontain" id="flip-li-37" class="ui-li ui-li-static ui-body-c ui-field-contain ui-body ui-br">
<div class="containing-element">
  <label for="flip-37" id="flip-37-label" class="ui-slider">X Y:</label>
  <select name="flip-37" id="flip-37" data-role="slider" data-mini="true" class="ui-slider-switch">
    <option value="off">Absent</option>
    <option value="on">Present</option>
  </select>
  <div role="application" class="ui-slider ui-slider-switch ui-btn-down-c ui-btn-corner-all ui-slider-mini" style>
    <span class="ui-slider-label ui-slider-label-a ui-btn-active ui-btn-corner-all" role="img" style="width: 0%; ">Present</span>
    <span class="ui-slider-label ui-slider-label-b ui-btn-down-c ui-btn-corner-all" role="img" style="width: 100%; ">Absent</span>
    <div class="ui-slider-inneroffset">
      <a href="#" class="ui-slider-handle ui-btn ui-btn-up-c ui-shadow ui-btn-corner-all ui-slider-handle-snapping" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" data-theme="c" role="slider" aria-valuemin="0" aria-valuemax="1" aria-valuenow="off" aria-valuetext="Absent" title="Absent" aria-labelledby="flip-37-label" style="left: 0%; ">
        <span class="ui-btn-inner ui-btn-corner-all">…</span>
      </a>
    </div>
  </div>
</div>
</li>

下面是周边环境:

    <div id="memberPage" data-role="page">
        <div data-role="content">
         <form>
                <ul data-role="listview" data-filter="true" id="memberList"></ul>
            </form>
        </div><!-- /content -->
  </div>

有可能是某种形式的计时问题;我通过写入到控制台捕获的部分增强项目,但写在调用之前刷新(其中,如果我离开调用刷新出来,登录原平扫项目)。

There might be some kind of timing issue; I captured the partially-enhanced item by writing it to the console, but wrote it BEFORE the call to refresh (which, if I leave the call to refresh out, logs the original unenhanced item).

如果它的事项,该项目会从一个对话框,通过该链接回页面列表(从而关闭对话框)按钮的onclick属性添加。

If it matters, the item gets added from a dialog through the onclick property of a button that links back to the page with the list (thus closing the dialog).

先谢谢您的任何见解。

Thanks in advance for any insights.

推荐答案

$('#会员)的触发器(创造)尝试; 而不是刷新列表视图的方法。我想,你一定要提升,不仅新的列表项,而且里面的滑块它可能工作。

Try with $('#memberList').trigger('create'); instead of refresh method of listview. I think it might work as you have to enhance not only the new list item but also the slider inside it.

这篇关于jQuery Mobile的列表视图(“刷新”)未完成的增强的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆