jquery mobile界面数据刷新
JQM里面当我们更新了某些页面标签(如: listview, radiobuttons, checkboxes, select menus)里的数据时,必须做refresh操作.
为什么必须做refresh操作操作呢?因为JQM在做页面渲染的时候,为了使样式跟客户端程序相似, 隐藏了原始的标签然后用一些新的标签和自定义的样式来表现原标签,其实新样式的标签已经不是原来的标签,所以更新了数据必须做refresh操作.
各类标签的刷新
1.Textarea fields
1
2
|
$( 'body' ).prepend( '<textarea id="myTextArea"></textarea>' ); $( '#myTextArea' ).textinput(); |
2.Text input fields
1
2
|
$( 'body' ).prepend( '<input type="text" id="myTextField" />' ); $( '#myTextField' ).textinput(); |
3.Buttons
1
2
|
$( 'body' ).append( '<a href="" data-theme="e" id="myNewButton">testing</a>' ); $( '#myNewButton' ).button(); |
4.Combobox or select dropdowns
1
2
3
4
5
6
7
8
9
10
|
<label for = "sCountry" >Country:</label> <select name= "sCountry" id= "sCountry" > <option value= "" >Where You Live:</option> <option value= "ad" >Andorra</option> <option value= "ae" >United Arab Emirates</option> </select> var myselect = $( "#sCountry" ); myselect[0].selectedIndex = 3; myselect.selectmenu( 'refresh' ); |
5.Listviews
1
2
3
4
5
6
7
|
<ul id= "myList" data-role= "listview" data-inset= "true" > <li>Acura</li> <li>Audi</li> <li>BMW</li> </ul> $( '#mylist' ).listview( 'refresh' ); |
6.Slider control
1
2
3
4
5
6
|
<div data-role= "fieldcontain" > <label for = "slider-2" >Input slider:</label> <input type= "range" id= "slider-2" value= "25" min= "0" max= "100" /> </div> $( '#slider-2' ).val(80).slider( 'refresh' ); |
7.Toggle switch
1
2
3
4
5
6
7
8
9
10
11
|
<div data-role= "fieldcontain" > <label for = "toggle" >Flip switch :</label> <select name= "toggle" id= "toggle" data-role= "slider" > <option value= "off" >Off</option> <option value= "on" >On</option> </select> </div> var myswitch = $( "#toggle" ); myswitch[0].selectedIndex = 1; myswitch .slider( "refresh" ); |
8.Radio buttons
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<div data-role= "fieldcontain" > <fieldset data-role= "controlgroup" data-type= "horizontal" > <legend>Layout view:</legend> <input type= "radio" name= "radio-view" value= "list" /> <label for = "radio-view-a" >List</label> <input type= "radio" name= "radio-view" value= "grid" /> <label for = "radio-view-b" >Grid</label> <input type= "radio" name= "radio-view" value= "gallery" /> <label for = "radio-view-c" >Gallery</label> </fieldset> </div> $( "input[value=grid]" ).attr( 'checked' , true ).checkboxradio( 'refresh' ); |
9.Checkboxes
1
2
3
4
5
6
7
8
9
|
<div data-role= "fieldcontain" > <fieldset data-role= "controlgroup" > <legend>Agree to the terms:</legend> <input type= "checkbox" name= "checkbox-1" id= "checkbox-1" class= "custom" /> <label for = "checkbox-1" >I agree</label> </fieldset> </div> $( '#checkbox-1' ).attr( 'checked' , true ).checkboxradio( 'refresh' ); |
JQM动态渲染各种问题的解决办法:
1、select动态渲染——“cannot call methods on selectmenu prior to initialization; attempted to call”
$('#selectID').selectmenu();
$('#selectID').selectmenu("refresh");
jquery mobile界面数据刷新的更多相关文章
- jquery mobile 请求数据方法执行时显示加载中提示框
在jquery mobile开发中,经常需要调用ajax方法,异步获取数据,如果异步获取数据方法由于网速等等的原因,会有一个反应时间,如果能在点击按钮后数据处理期间,给一个正在加载的提示,客户体验会更 ...
- 分享自制的13套 JQuery Mobile 界面主题(追加4套新款)
15套整合在一起的,其中2套官方+13套自制,款款精致,方便移动开发. 字体默认为微软雅黑. 适配于 JQuery Mobile 1.4.3 下载地址:http://files.cnblogs.com ...
- jquery完成界面无刷新加载登陆注册
昨天公司说官网的登陆注册每次要跳转到另一个界面,能不能做一个简单的,在界面弹出一个框框登陆,我想了想做了这么一个案例,大家来看看成不成 贴上代码,实现了在同一个弹出窗上加载了登陆注册功能!可自由点击! ...
- jquery mobile各类组件刷新方法
1.Combobox or select dropdowns var myselect = $("#sCountry"); myselect[0].selectedIndex ...
- Jquery mobile 新手问题总汇
1页面缩放显示问题 问题描述: 页面似乎被缩小了,屏幕太宽了. 解决办法: 在head标签内加入: <meta name="viewport" content="w ...
- [转载]Jquery mobile 新手问题总汇
原文链接:http://www.wglong.com/main/artical!details?id=4 此文章将会持续更新,主要收录一些新手比较常见的问题. 欢迎 向我推荐比较典型的常见问题,我会记 ...
- Jquery Mobile实例--利用优酷JSON接口读取视频数据
本文将介绍,如何利用JqueryMobile调用优酷API JSON接口显示视频数据. (1)注册用户接口. 首页,到 http://open.youku.com 注册一个账户,并通过验证.然后找到A ...
- jquery mobile Checkbox动态添加刷新及事件绑定
jquery mobile Checkbox动态添加刷新及事件绑定 在微信项目中,涉及到一个多选功能.数据来自后台数据库,需要动态加载. 项目结构:微信api+web app.使用jquery mob ...
- Jquery Mobile 动态添加元素然后刷新 转
Jquery Mobile 动态添加元素然后刷新 (2013-05-09 12:39:05) 转载▼ 标签: it 分类: Mobile jquery 表单元素每一个元素都有自己刷新的方法,每当改变它 ...
随机推荐
- FMS直播流发布时 Microphone Speex 编码设置注意事项
1.为何要用 Speex?FP的默认音频编码是 NellyMoser,而FP10之后加入了 Speex.实际应用中,用默认的 NellyMoser 编码音频,会有个很大的问题,就是无法控制流码率浮动. ...
- Eclispe怎么给工作空间下的项目分组
Eclispe怎么给工作空间下的项目分组 第一步,打开Java Working Set 第二步,添加分组 第三步,选择分组
- 在Apache中使用mod_rewrite模块重写URL
如果有使用第三方框架做项目时,url路径是可以同过框架给的方法来设定的(如thinkphp),但如果使用原生php写的项目又想重写url,则可通过apache的一些设置来达到想要的效果. 在更改apa ...
- Xss里img标签的一些利用
<img src=x onerror=with(document)body.appendChild(document.createElement('script')).src="//x ...
- 通过 --py-files 可以在pyspark中可以顺利导入
文件import问题 问题: 在脚本中import了其他文件, pyspark中可以运行, 但是在spark-submit中总是失败 假定我们的任务脚本为 app.py , 大体代码像这样: from ...
- PowerDesigner 15.2入门学习 二
PowerDesigner中如何生成主键和自增列 1.SQL Server版本: 第一步,首先要建立与数据库的连接,方法较多,这里举个例子: http://www.cnblogs.com/netsql ...
- Linux搭建QT环境笔记
*** [../../../../lib/libQtWebKit.so.4.7.4] Error 1make[1]: Leaving directory `/home/cloverbox/qt-eve ...
- Spring定时任务的几种实现
近日项目开发中需要执行一些定时任务,比如需要在每天凌晨时候,分析一次前一天的日志信息,借此机会整理了一下定时任务的几种实现方式,由于项目采用spring框架,所以我都将结合 spring框架来介绍. ...
- ASCII字符对照表 不时之需
ASCII可显示字符 二进制 十进制 十六进制 图形 0010 0000 32 20 (空格)(␠) 0010 0001 33 21 ! 0010 0010 34 22 " 0010 001 ...
- 《Linux内核分析》第四周 扒开系统调用的“三层皮”
[刘蔚然 原创作品转载请注明出处 <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000] WEEK FOUR( ...