且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JQM(jQueryMobile)问题与 AJAX 内容列表视图('refresh')不工作

更新时间:2023-02-23 17:34:44

  1. 一定要在ul元素上调用.listview
  2. 如果之前没有设置样式,您只需调用 .listview(),机器人刷新功能.如果您的萤火虫设置正确,您应该会看到一条错误消息告诉您这一点.
  1. Be sure to call .listview on the ul element
  2. If it didn't style earlier, you just call .listview(), bot the refresh function. If your firebug setup is correct, you should have seen an error message telling you that.

在您发布修复程序之前,我没有时间开始创建一些代码,但这里有我的一些建议:

I didn't have time to get down to creating some code before you posted your fix, but here's a little recommendation from me:

if(data !== null){ $('#display_'+page+'_page').html(data).find("ul").listview() }

这比新的全局选择器好一点.此外 - 您不需要 div,如果您有多个 UL,您可以提供详细的选择器.

This is a bit nicer than a new global selector. Also - you don't need the div and you can provide a detailed selector if you have multiple ULs.

注意:以上代码需要data !== null.如果它为空 - 它会抛出一个错误.

caution: the above code requires data !== null. If it's null - it will throw an error.