我想在点击图像时在ext.js模态窗口中显示图像

时间:2016-06-30 19:51:23

标签: extjs modal-dialog

我有一个文件,它通过xls处理并转换为HTML并呈现给Extjs。我的问题是图像链接在xls中。单击图像后,我无法看到图像,因为它的iamge URL没有通过函数调用调用。

我怎样才能得到它? 这是我的代码 -

EXTJS: -

var showModal = function(url){   
    var previewWindow = new Ext.Window({
        modal:true,
        border:false,
        plain:true,
        width:500,
        height:500,
        constrain:true,
         html:'<div style="width:500px;height:500px;"><img src="url"></div>',
        resizable:{preserveAspectRatio: true}
    });
    previewWindow.show();
};

Xls代码: -

  <xsl:when test="@align='left'">
    <div class="imageleft">
        <img width="{$image_width}" height="{$image_height}"
          class="image" src="vll/getImage?resource={$image_ref}" 
          onClick="showModal('vll/getImage?resource={$image_ref}')" >
                <xsl:apply-templates/>
        </img>
    </div>
</xsl:when>

1 个答案:

答案 0 :(得分:0)

正如您在语法高亮显示中所看到的,您没有使用变量,而是字符串&#34; url&#34;。请尝试以下方法:

html:'<div style="width:500px;height:500px;"><img src="'+url+'"></div>',

并获得一个语法高亮的编辑器,例如Notepad++(还有其他在ExtJS开发中有用的功能,如目录中的搜索和替换)。