请教一个extjs组件的问题

image = new Ext.BoxComponent({
fieldLabel : '图片',
id:'photoShow',
autoEl : {

width : 100,

height :100,

tag : 'img',

}

});
请问如何在这种图片组件的外层加一个类似div的东西?并且这个类似div的东西位置大小要固定。感激不尽

你renderTo到指定的div容器,div设置好大小位置不就好了?

请问这个可以实现吗?

哪个版本的 extjs

写一个panel,将图片放panel里面

先新建一个div 固定住这个div 然后再div里面创建一个img

$("#screenshot").attr("src", "data:image/png;base64," + image); 写进去就好了

http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.BoxComponent

renderTo : Mixed
Specify the id of the element, a DOM element or an existing Element that this component will be rendered into.

Notes :
Do not use this option if the Component is to be a child item of a Container. It is the responsibility of the Container's layout manager to render and manage its child items.
When using this config, a call to render() is not required.
See render also.

Available since: 2.3.0

3.2.1 版本的应该跟 3.4.0 版本一致,可以通过 BoxComponent 新建一个 div 或者直接在页面上写好 div,并在创建图片时增加 renderTo 属性,如下:

image = new Ext.BoxComponent({
    fieldLabel : '图片',
    id:'photoShow',
    autoEl : {
        width : 100,
        height :100,
        tag : 'img',
    },
    renderTo: 'id-of-div'
});