1

我根据特定 id 检索图像并使用 ExtJS 4 显示为数据视图。现在我需要通过 dbl 单击图像来调用函数。

Ext.define('${pkgName}.v02x003001.SV02X00300102', {
    extend: 'Ext.view.View',
    alias: 'widget.sv02x00300102',
    id: 'images-view',
    autoScroll: true,
    trackOver: true,
    multiSelect: true,
    height: 180,
    overItemCls: 'x-item-over',
    itemSelector: 'div.thumb-wrap',
    emptyText: 'No images to display',
    prepareData: function (data) {
        Ext.apply(data, {
            shortName: Ext.util.Format.ellipsis(data.name, 15),
            sizeString: Ext.util.Format.fileSize(data.size),
            dateString: Ext.util.Format.date(data.lastmod, "m/d/Y g:i a")
        });
        return data;
    },
    initComponent: function () {
        var me = this;
        var member = Ext.getCmp('member-sv02x00300104').getValue();
        me.store = 'S02X003001';
        me.tpl = [
            '<tpl for=".">',
            '<div class="thumb-wrap" id="{name}">',
            '<div class="thumb">
            <img  src="${createLink(mapping:'
        img ', params:[])}/{id}/100/100/" title="{id}">
                   </div>',
            '<span class="x-editable">{name}</span></div>',
            '</tpl>',
            '<div class="x-clear"></div>'];

        me.callParent(arguments);
    }
});
4

1 回答 1

1

此代码是否适合您的需求(此处的文档)?

listeners: {
    itemdblclick: function (view, record, item, index, e) {
        if (Ext.get(e.getTarget()).is('img')) {
            alert('you double clicked an image');
        }
    }
}
于 2013-06-22T15:15:34.817 回答