Uncaught cannot call methods on listview prior to initialization; 在刷新动态内容时报错的解决方案
来源:互联网 发布:软件项目介绍费 编辑:程序博客网 时间:2024/05/18 13:23
在玩jQuery Mobile时需要动态向Listview添加内容,但内行都知道,新增的内容是不带mobile样式和效果的,需要调用mobile提供的刷新函数,对于Listview,需要调用listview(‘refresh’),但是,在测试时会得到jQuery Mobile抛出的如下异常信息Uncaught cannot call methods on listview prior to initialization; attempted to call method 'refresh'
,在stackoverflow上也有不少人问,但都没有说到点子上。
经过Magic哥的一番实验,发现这是因为在调用refresh时,jQuery Mobile对象还没有完成初始化,导致调用refresh时被jQuery Mobile抛出异常。
解决方案是给jQuery Mobile留出初始化的时间,用0秒延时的setTimeout就可以,至少哥的问题就这么解决了。
setInterval("$listview.listview('refresh')",0);
- Uncaught cannot call methods on listview prior to initialization; 在刷新动态内容时报错的解决方案
- Uncaught Error: cannot call methods on dialog prior to initialization; attempted to call method 'clo
- Uncaught Error: cannot call methods on fileupload prior to initialization; attempted to call method
- jquery.min.js:4 Uncaught Error: cannot call methods on dialog prior to initialization; attempted to
- 在jquerymobile实现listview局部渲染的方法: listviewcannot call methods on listview prior to initialization; att
- 解决Error: cannot call methods on tabs prior to initialization; attempted to call method 'disable'的方法
- cannot call methods on masonry prior to initialization; attempted to call method 'appended' 瀑布流
- cannot call methods on button prior to initialization; attempted to call method 'toggle' 解决
- cannot call methods on dialog prior to initialization; attempted to call method 'close'
- Error: cannot call methods on draggable prior to initialization; attempted to call
- cannot call methods on dialog prior to initialization; attempted to call method 'close'
- cannot call methods on tooltip prior to initialization; attempted to call method 'hide'
- cannot call methods on tooltip prior to initialization; attempted to call method 'close'(…)
- cannot call methods on button prior to initialization; attempted to call method 'loading'.
- ListView内容动态刷新
- ListView内容动态刷新
- ListView内容变化后的动态刷新
- ListView内容变化后的动态刷新
- 求解!!!(想要求的是金字塔形状的) 星星
- 函数求“*”图
- 12864液晶模块驱动
- js 获取、更改HTML元素属性
- 1到n的阶乘和
- Uncaught cannot call methods on listview prior to initialization; 在刷新动态内容时报错的解决方案
- POJ 1845 数论
- POJ 2594 Treasure Exploration
- bash笔记:天级别的时间段
- postgresql 数据文件损坏回复实验
- unity3d中资源文件从MAX或者MAYA中导出的注意事项
- 读图-Google那些你不知道的事
- [黑马程序员]--Java语言基础一
- 第十二周上机项目一--调用函数输出星号图