jquerymobile错误"不能调用列表视图的方法来初始化和QUOT之前; [英] jquerymobile error "cannot call methods on listview prior to initialization"

查看:292
本文介绍了jquerymobile错误"不能调用列表视图的方法来初始化和QUOT之前;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我动态填充

<ul data-role="listview">

然后调用location.href =#结果里的名单,最后.listview('刷新')结果
所有这一切都从同一个页面一个Ajax请求的成功回调完成后,

then calling location.href="#Results" where the list is, and finally .listview('refresh')
All that is done in the success callback of an ajax request from the same page,

它的工作原理或多或少,但我发现了以下错误

It works more or less but I'm getting the following error

Uncaught cannot call methods on listview prior to initialization; attempted to call method 'refresh'

我想jQuery的移动没有​​contruct列表视图还没有,我能怎么办呢?

I guess Jquery-mobile did not contruct the listview yet, what could I do?

推荐答案

<一个href=\"http://jquerymobile.com/demos/1.1.0/docs/api/events.html\">http://jquerymobile.com/demos/1.1.0/docs/api/events.html
你要勾上的pageinit事件。你不能调用此之前的任何JQM方法。
即:

http://jquerymobile.com/demos/1.1.0/docs/api/events.html You have to hook on the pageinit event. You can't call any JQM methods prior to this. i.e.:

$('#Results').bind('pageinit', function() {
  $('#myListview').listview('refresh');
});

这篇关于jquerymobile错误&QUOT;不能调用列表视图的方法来初始化和QUOT之前;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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