sencha-touch1.1中的panel如何载入模板
来源:互联网 发布:sql union 多列 编辑:程序博客网 时间:2024/05/01 08:13
Sencha Touch 交流 QQ 群 224711028
我们首先仿照example中的ajax例子
在index.html上定义模板:
<textarea id="weather" class="x-hidden-display"> <tpl for="."> <div class="day"> <div class="date">{date}</div> <tpl for="weatherIconUrl"><img src="{value}"/></tpl> <span class="temp">{tempMaxF}°<span class="temp_low">{tempMinF}°</span></span> </div> </tpl></textarea>
然后在页面代码中使用json request方法将回调的参数载入模板并渲染到panel控件上
var tpl = Ext.XTemplate.from('weather'); Ext.util.JSONP.request({url: 'http://free.worldweatheronline.com/feed/weather.ashx',callbackKey: 'callback',params: { key: '23f6a0ab24185952101705',// palo altoq: '94301',format: 'json',num_of_days: 5},callback: function(result) {result.aaa='bbb';var weather = result.data.weather;//alert(weather[0].aaa);weather[0].aaa='bbb';if (weather) {var html = tpl.applyTemplate(weather);Ext.getCmp('content').update(html); }else {alert('There was an error retrieving the weather.');}}});var newPanel=new Ext.Panel({ fullscreen: true,id: 'content',scroll: 'both'})
如此便可得到经过渲染后的panel了,结果如下:
- sencha-touch1.1中的panel如何载入模板
- sencha-touch1.1中如何点击button弹出一个"popup" panel
- sencha-touch1.1-combobox(selectfield)如何获得选中的value
- sencha-touch1.1中如何对数据源进行筛选
- sencha-touch1.1中的时间转换函数用法
- sencha-touch1.1播放视频
- sencha-touch1.1中如何对list表item进行选中
- 初学sencha-touch1.1-mvc教程3篇
- sencha-touch1.1获得数据源中store的最大值
- sencha-touch-1.1如何动态更新panel的title
- sencha touch2中panel如何绑定tap事件
- Sencha Touch NestList 如何载入tree结构的数据
- sencha touch如何动态改变panel里面的background-image元素
- sencha touch2 在control层给panel应用XTemplate模版,并加载store中的数据
- sencha-touch如何修改url中的参数
- 如何动态载入到sencha-touch的combobox(selectfield)中
- Panel采用autoLoad载入页面如何传参更新页面——EXTJS2.2.1
- Sencha Touch实现点击Panel,切换带图片的Panel
- 交换机进行syslog服务器设置
- 各浏览器中cookie个数和大小限制汇总(转)
- StageFright框架流程解读
- android 开发笔记
- C# Dictionary
- sencha-touch1.1中的panel如何载入模板
- C++中的overload,overwritting,overriding
- Eclipse快捷键大全
- Java基础:数组Array转成List的几种方法
- NameNode对域名/IP的解析——DNSToSwitchMapping
- 深入CACHE
- C++ 工厂方法2
- MotionEvent的getX(),getY()与getRawX(),getRawY()区别
- C#发送邮件