插入jQuery模板后,jQuery Mobile不呈现列表 [英] jquery mobile does not render list after jquery template was inserted

查看:105
本文介绍了插入jQuery模板后,jQuery Mobile不呈现列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jquery模板向 Mobile网站添加

  • 标签.它添加了li标签,但是没有以标准的jqueryMobile样式设置样式.我可以通过检查DOM直观地看到它:jquery mobile添加了类并转换为div和span类,在我的情况下,我看到了没有任何jquery mobile类的plane ul和li标签.我有一个版本,它首先加载Jquery Mobile,然后注入jquery模板,并且Mobile不刷新该列表并且不设置其样式.注入jquery模板后,有没有办法修复它并显示标准的jMobile列表?谢谢

    I am adding

  • tags using jquery templates to jquery Mobile website. It adds li tags, however it does not style in the standard jqueryMobile style. I can see it visually and by inspecting DOM: jquery mobile adds classes and convert to div and span classes, where in my case I see plane ul and li tags without any jquery mobile classes. I have a version, that it loads first Jquery Mobile, and then injects jquery template and Mobile does not refresh that list and doesnt style it. Is there a way to fix it and display standard jMobile list after jquery template was injected? Thanks

    推荐答案

    jQM文档:

    更新列表:如果将项目添加到列表视图,则需要在其上调用refresh()方法以更新样式并创建任何嵌套的 添加的列表.例如:

    Updating lists If you add items to a listview, you'll need to call the refresh() method on it to update the styles and create any nested lists that are added. For example:

    $('#mylist').listview('refresh');
    

    请注意,refresh()方法仅影响附加到节点的新节点. 列表.出于性能原因执行此操作.已经有任何清单项目 增强功能将被刷新过程忽略.这意味着 您可以更改已经增强的列表中的内容或属性 项目,这些将不会得到反映.如果您要更新列表项, 在调用刷新之前,将其替换为新鲜的标记.

    Note that the refresh() method only affects new nodes appended to a list. This is done for performance reasons. Any list items already enhanced will be ignored by the refresh process. This means that if you change the contents or attributes on an already enhanced list item, these won't be reflected. If you want a list item to be updated, replace it with fresh markup before calling refresh.

    这篇关于插入jQuery模板后,jQuery Mobile不呈现列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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