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 表单元素每一个元素都有自己刷新的方法,每当改变它 ...
随机推荐
- memcache 缓存失效问题(转)
在大并发的场合,当cache失效时,大量并发同时取不到cache,会同一瞬间去访问db并回设cache,可能会给系统带来潜在的超负荷风险. 解决方法 方法一 在load db之前先add一个mutex ...
- GO语言练习:第二个工程--模拟音乐播放器
1.代码 2.编译及运行 1.目录结构 1.1) $ tree . ├── mplayer.go └── src ├── mlib │ ├── manager.go │ └── manager ...
- MySQL中引号的问题
原文: http://blog.csdn.net/wisgood/article/details/6317543 mysql中一个字符串,既可以用两个单引号表示,也可以用两个双引号表示. 比如字符串 ...
- 运行在VMware上的Linux虚拟机如何使用NAT模式连接物理机的外部网络
在VMware Workstation中,默认有3个虚拟交换机,分别是VMnet0(使用桥接网络).VMnet1(仅主机网络)和VMnet8(NAT网络). 首先说一下为什么要用NAT模式,如果你的物 ...
- JSON与DataTable(DataSet)相互转化
public static string CreateJsonParameters(DataTable dt) { /* /******************** ...
- JDBC链接oracle已经mysql的测试
1.链接oracle package cn.itcast.mybatis.dao; import java.sql.Connection;import java.sql.DriverManager;i ...
- Oracle 常用数据类型(转)
varchar2(6) 张三 --在jbk中是两个字节,在utm中是三个字节char(6) 张 三 --可以确定长度的用charclob --大存储,没事少用,当多余4000字节时,会用lob来存储, ...
- 滚动固定TAB在顶部显示
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http ...
- C#中 MD5和SHA1加密代码
Pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(entity.Pwd, "MD5"); Pwd = For ...
- Centos5下安装监控工具nmon
一.nmon下载地址http://nmon.sourceforge.net/pmwiki.php?n=Site.Download 二.下载centos5对应版本nmon_linux_14i.tar.g ...