首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

sencha touch当list没数据时显示提示语或图片等

2013-10-30 
sencha touch当list没有数据时显示提示语或图片等在sencha touch项目做list时需要在没有数据的情况下显示

sencha touch当list没有数据时显示提示语或图片等
在sencha touch项目做list时需要在没有数据的情况下显示图片和提示语句,最开始使用了笨办法,就是在controller动态改变view层内容

今天在看sencha touch文档时发现sencha原本就有解决这种情况的方法,只需在view加emptyText属性即可,
修改后代码如下(controller中不做任何操作,只需在view页面添加emptyText属性):

Ext.define('Haier.view.phone.Todo.List', {extend : 'Ext.Container',xtype : 'todoList',config : {id : 'todoHomeId',title : "待办中心",items : [ {id : 'todoList',store : 'Todo',xtype : 'list',height : null,disableSelection : 'false',emptyText : "<div style='height:"+ window.innerHeight+ "px;padding-top:100px'><img src='images/todo_null_list_bg.png' width='120' height='150'/><div style='text-align:center;color:#8a8c8e'>暂时没有待办事项</div></div>",itemTpl : [ "<div><span>{TodoTitle}</span></div>" ].join('')} ],}});

热点排行