Ext 展示图片列表(笔记1)

Ext 展示图片列表

1、效果图:

2、js代码

			Ext.require([
				'Ext.view.View'
			]);

			Ext.onReady(function() {
				
				Ext.define('img_view', {
                    extend: 'Ext.data.Model',
                    fields: ['name', 'url', 'id']
                });
                store = Ext.create('Ext.data.Store', {
                    model: 'img_view'
                });

				Ext.create('Ext.Panel', {
					id: 'images-view',
		        	width: '100%',
		        	renderTo: 'dataview-example',
			        items: Ext.create('Ext.view.View', {
		            store: store,
		            tpl: [
		                '<tpl for=".">',
		                    '<div class="thumb-wrap" id="{id}">',
		                        '<div class="thumb"><img src={url} οnerrοr="this.src=\'img/imgDef.png\';" ></div>',
		                        
		                    '</div>',
		                '</tpl>',
		                '<div class="x-clear"></div>'
		            ],
		            selectionModel: {
		                mode   : 'MULTI'
		            },
		            trackOver: true,
		            overItemCls: 'x-item-over',
		            itemSelector: 'div.thumb-wrap',
		            emptyText: 'No images to display',
		            plugins: [
		                Ext.create('Ext.ux.DataView.DragSelector', {}),
		                Ext.create('Ext.ux.DataView.LabelEditor', {dataIndex: 'name'})
		            ],
			        })
		    	});
                        vm.load();//调用自定义的load方法,为store传值
			});
3、css

#images-view .x-panel-body{
    background: white;
    font: 11px Arial, Helvetica, sans-serif;
}
#images-view .thumb{
    background: #dddddd;
    padding: 3px;
    padding-bottom: 3px;
}

.x-quirks #images-view .thumb {
    padding-bottom: 3px;
}

#images-view .thumb img{
    height: 100px;
    width: 100px;
}
#images-view .thumb-wrap{
    float: left;
    margin: 4px;
    margin-right: 0;
    padding: 5px;
}
#images-view .thumb-wrap span {
    
    display: block;
    overflow: hidden;
    text-align: center;
    width: 86px; /* for ie to ensure that the text is centered */
}

#images-view .x-item-over{
    border:1px solid #dddddd;
    background: #efefef url(over.gif) repeat-x left top;
    padding: 4px;
}

#images-view .x-item-selected{
    background: #eff5fb url(selected.gif) no-repeat right bottom;
    border:1px solid #99bbe8;
    padding: 4px;
}
#images-view .x-item-selected .thumb{
    background:transparent;
}

#images-view .loading-indicator {
    font-size:11px;
    background-image:url('../../resources/themes/images/default/grid/loading.gif');
    background-repeat: no-repeat;
    background-position: left;
    padding-left:20px;
    margin:10px;
}

.x-view-selector {
    position:absolute;
    left:0;
    top:0;
    width:0;
    border:1px dotted;
    opacity: .5;
    -moz-opacity: .5;
    filter:alpha(opacity=50);
    zoom:1;
    background-color:#c3daf9;
    border-color:#3399bb;
}
.ext-strict .ext-ie .x-tree .x-panel-bwrap{
    position:relative;
    overflow:hidden;
}
.x-editable {
    color: #000;
}



评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值