改掉这里
var imageTpl = new Ext.XTemplate(
'<tpl for=".">',
'<div style="margin-bottom: 10px;float:left;" class="thumb-wrap">', //增加float:left;
'<img src="{src}" title="{caption}"/>',
'<br/><span>{caption}</span>',
'</div>',
'</tpl>'
);
var imageTpl = new Ext.XTemplate(
'<tpl for=".">',
'<div style="margin-bottom: 10px;float:left;" class="thumb-wrap">', //增加float:left;
'<img src="{src}" title="{caption}"/>',
'<br/><span>{caption}</span>',
'</div>',
'</tpl>'
);
解决方案 »
- jquery中使用submit()的问题(高手请进-急)
- extjs 为何在IE7下 gridpanel的信息不显示 而火狐可以 要设置什么吗
- 关于innerHTML的问题,请大家帮忙
- js提示参数无效
- 初学javascript,请帮助注解一下下面的一段代码,高分,急
- 哪个哥哥帮下,分不够,再加啊!
- 怎样通过name才获取这个数组
- 火急,在子窗怎样关闭整个框架窗口,在线等待
- 有判断是否为合法日期的函数吗?
- 各位大虾:请问如何动态修改textarea的wrap属性,我无法实现对textarea.wrap.value的赋值
- 第一次打开浏览器加载datagrid,没有进入url指定的后台方法
- juqery append添加顺序问题
<!DOCTYPE html><html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="public/ext-4.2.1.883/resources/css/ext-all.css"/>
<script type="text/javascript" src="public/ext-4.2.1.883/ext-all.js"></script>
</head>
<body>
<script type="text/javascript">
Ext.onReady(function(){
Ext.define('Image', {
extend: 'Ext.data.Model',
fields: [
{ name:'src', type:'string' },
{ name:'caption', type:'string' }
]
});Ext.create('Ext.data.Store', {
id:'imagesStore',
model: 'Image',
data: [
{ src:'http://www.sencha.com/img/20110215-feat-drawing.png', caption:'图1' },
{ src:'http://www.sencha.com/img/20110215-feat-data.png', caption:'图2' },
{ src:'http://www.sencha.com/img/20110215-feat-html5.png', caption:'图3' },
{ src:'http://www.sencha.com/img/20110215-feat-perf.png', caption:'图4' }
]
});var imageTpl = new Ext.XTemplate(
'<tpl for=".">',
'<div style="margin-bottom: 10px;float:left;" class="thumb-wrap">', //增加float:left;
'<img src="{src}" title="{caption}"/>',
'<br/><span>{caption}</span>',
'</div>',
'</tpl>'
);var imageView = Ext.create('Ext.view.View', {
store: Ext.data.StoreManager.lookup('imagesStore'),
tpl: imageTpl,
overCls: "x-view-over",
overItemCls: "x-view-over",
itemSelector: 'div.thumb-wrap',
emptyText: 'No images available'
}); var panel = Ext.create("Ext.panel.Panel",
{
id: 'images-view',
frame: true,
width: 1024,
//autoHeight: true,
height:700,
collapsible: true,
layout: 'fit',//是不是这里fit布局不对?
items: imageView
});
panel.render(Ext.getBody());});
</script>
</body>
</html>
可以了,对比了下,你多改了一个地方:
//autoHeight: true,
height:700,
另外还有点不大理解的是:为何自动高度无效,非改成固定高度呢?
自动计算的问题,你可以确定高度以后自动宽度
height:300,
autoWidth: true,
'<tpl for=".">',
'<div style="margin-bottom: 10px;float:left" class="thumb-wrap">',
'<img src="{src}" title="{caption}"/>',
'<br/><span>{caption}</span>',
'</div>',
'</tpl>'
); var imageView = Ext.create('Ext.view.View', {
store: Ext.data.StoreManager.lookup('imagesStore'),
tpl: imageTpl,
overCls: "x-view-over",
overItemCls: "x-view-over",
itemSelector: 'div.thumb-wrap',
emptyText: 'No images available', style: 'overflow:auto;zoom:1;'
});
确实高可以不用设置了,学习了,什么都不说了,赞一个,