ExtJS:将图像渲染到现有div

时间:2015-05-31 08:17:42

标签: javascript extjs

我在一个相当复杂的UI项目中使用ExtJS。我有一个与此类似的配置对象:

       app:borderWidth="0dp"
       app:elevation="4dp"

       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_margin="8dp"/>

在我的功能中,我创建了一个像这样的图像:{ xtype: 'component', html: "<a href='some link'>some text</a><div id='someDivId'/>" }

如何将Ext.create('Ext.Img', {/* image config */});生成的图像放入DOM元素Ext.create

2 个答案:

答案 0 :(得分:1)

您需要的只是renderTo配置。

Ext.create( 'Ext.Img',
    {
        ...
        renderTo: 'someDivId' // you can use IDs directly, HTML elements and Ext elements
    } );

文档:http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.Img-cfg-renderTo

答案 1 :(得分:-1)

使用Ext.create('Ext.Img', {})代替Ext.Img()

相关问题