Code:
var imageView = new Ext.Panel({
height:300,
width:300,
autoHeight:false,
autoWidth:false,
autoScroll:true,
border:false,
region: 'center',
layout: 'fit'
})
var browseFileForm = new Ext.form.FormPanel({
fileUpload: true,
height:23,
width:87,
autoHeight:false,
autoWidth:false,
border:false,
bodyStyle:'background: red; padding: 0;',
region: 'south',
items:[{
xtype: 'fileuploadfield',
id: Ext.id(),
listeners: {
'fileselected': this.onFileSelected.createDelegate(this)
},
buttonOnly: true,
buttonOffset:0,
buttonCfg: {
text: 'Browse',
iconCls: 'brite-icon-browse'
}
}],
layout:'table',
errorReader: new Ext.data.XmlReader({
record: 'file',
success: '@success'
},['url'])
})
browseFileForm.setHeight(23)
browseFileForm.setWidth(87)
var buttonsPanel = new Ext.Panel({
height:34,
width:200,
autoHeight:false,
autoWidth:false,
border: false,
bodyStyle:'padding:5px; background: #CAD9EC;',
layout : 'table',
layoutConfig: {
columns: 3
},
items:[
browseFileForm,
new Ext.Button({
cls: 'x-btn-text-icon',
iconCls: 'brite-icon-delete',
text: 'Clear',
handler: this.onFileClear.createDelegate(this)
})
]
})
var win = new Ext.Window({
height: 300,
width: 300,
autoHeight:false,
autoWidth:false,
title: 'Upload image',
autoCreate : true,
closeAction:'hide',
plain: true,
layout : 'table',
layoutConfig: {
columns: 1
},
items:[imageView,buttonsPanel],
buttons: [{
cls: 'x-btn-text-icon',
iconCls: 'brite-icon-accept',
text: 'Done',
handler: this.onFileDone.createDelegate(this)
}]
})
win.show()