Sencha touch中Ext.List如何高度自适应的解决方法
2014-03-20 13:43
429 查看
在使用Sencha Touch2.0的List控件时我们都知道必须指定List的Height,否则将不会显示,而我们在使用List的时候往往是将其放在页面的一个版块,而不会是简单的
fullscreen:true
此时我们为了让List能自适应高度,将Height指定为100%会其他比例,单却还是无法显示,具体原因当然很多,在下并不太会css,因此在此之前就是因为因为无法达到预期效果才想出下面这种笨拙的方法,勿喷:
Ext.define('app.view.MyList', {
extend: 'Ext.List',
xtype: 'commentList',
config: {
itemHeight: 60,
scrollable: {
disabled: true
},
store: 'MyStore'
},
refresh: function()
{
var height = this.getStore().getCount();
if(height){
this.setHeight(this.getItemHeight()* height);
}
this.callParent(arguments);
}
});
核心就是重载List的refresh方法,动态改变其高度。个人觉得这个方法必然效率太差,但还没想到更好的,欢迎大家慷慨解囊,提出更好方法。
fullscreen:true
此时我们为了让List能自适应高度,将Height指定为100%会其他比例,单却还是无法显示,具体原因当然很多,在下并不太会css,因此在此之前就是因为因为无法达到预期效果才想出下面这种笨拙的方法,勿喷:
Ext.define('app.view.MyList', {
extend: 'Ext.List',
xtype: 'commentList',
config: {
itemHeight: 60,
scrollable: {
disabled: true
},
store: 'MyStore'
},
refresh: function()
{
var height = this.getStore().getCount();
if(height){
this.setHeight(this.getItemHeight()* height);
}
this.callParent(arguments);
}
});
核心就是重载List的refresh方法,动态改变其高度。个人觉得这个方法必然效率太差,但还没想到更好的,欢迎大家慷慨解囊,提出更好方法。
相关文章推荐
- flex 控件的重要属性
- web下载的ActiveX控件自动更新
- ASP.NET的HtmlForm控件学习及Post与Get的区别概述
- sencha ext js 6 快速入门(必看)
- ASP.net 动态加载控件时一些问题的总结
- ASP.NET 4中的可扩展输出缓存(可以缓存页面/控件等)
- .NET中TextBox控件设置ReadOnly=true后台取不到值三种解决方法
- asp.net DataGrid控件中弹出详细信息窗口
- asp.net Repeater控件的说明及详细介绍及使用方法
- 分析10个ASP.NET控件最有用的属性详解
- javascript利用控件对windows的操作实现原理与应用
- js中判断控件是否存在
- python实现360皮肤按钮控件示例
- python和pyqt实现360的CLable控件
- .NET示波器控件的实例代码分析
- asp.net中将js的返回值赋给asp.net控件的小例子
- jquery设置控件位置的方法
- android开发教程之自定义控件checkbox的样式示例
- Android 布局控件之LinearLayout详细介绍
- Repeater控件绑定的三种方式