iteye_1952 2010-10-12 14:32
浏览 284
已采纳

ext 我用DataView 显示图片列表,图片下面的链接点击没反应,各位帮忙看看

[code="java"]
var picPs = new Ext.data.JsonStore({
url: "getPic.action"+"?programInstanceId="+ node.id,
root: 'images',
fields: ['name', 'url','state', {name:'size', type: 'float'}]
});
picPs.load();

var tpl = new Ext.XTemplate(
    '<tpl for=".">',
            '<div class="thumb-wrap" id="{url}">',
     '<div class="thumb"><a href="{url}" target="_blank" class="photo"><img src="{url}"     title="{name}"></a></div>',
         '<tpl if="this.isTrue(state)==true">',
                 '<span >停止    <a href="{url}">取消</a></span></div>',
             '</tpl>',
         '<tpl if="this.isTrue(state)==false">',
         '<span><a href="baidu.com" target="_blank">开始</a>    <a href="http://www.baidu.com" target="_blank">删除</a></span></div>',                   
            '</tpl>',
    '</tpl>',

    {
    isTrue: function(state){
        return state == true;
    }}        
);

var picPanel = new Ext.Panel({
    id:'images-view',
    frame:true,
    width:410,
    height:270,
    collapsible:true,
    layout:'fit',
    title:'图片',
    tbar : [{
            text : '上传',
            iconCls : 'db-icn-upload',
            handler : function() {
                var dialog = new Ext.Window({
                            title : '多文件上传',
                            name:'dialog',
                            width : 500,
                            height : 500,
                            itemId:node.id,
                            resizable : false,
                            layout : 'fit',
                            items : [{
                                xtype : 'uploadpanel',
                                uploadUrl : 'uploadFiles.action',
                                filePostName : 'myUpload', 
                                flashUrl : 'ExtJs/swfupload/swfupload.swf',
                                fileSize : '500 MB',
                                height : 400,
                                border : false,
                                fileTypes : '*.*', 
                                fileTypesDescription : '图片或XML文件',
                                postParams : {
                                path : node.text + '\\',
                                            programInstanceId:node.id
                                        }
                                    }],
                            listeners : {
                                "close" : function() {
                                    this.tpl=tpl2;
                                    picPs.reload();
                                    picPanel.view.refresh();
                                    //Ext.get(node.id+pic).tpl=tpl2;
                                }
                            },
                            bbar : ['fm1039.com']
                        });

                dialog.show();
            },
            scope : this
            }],
    items: new Ext.DataView({
        store: picPs,
        tpl: tpl,
        height:270,
        id:node.id+'pic',
        multiSelect: true,
        overClass:'x-view-over',
        itemSelector:'div.thumb-wrap',
        emptyText: 'No images to display',


        listeners: {
            dblclick:{
                fn:function(dv,nodes){                  
                    var cn = dv.getSelectedNodes()[0];

                        var showPic = new Ext.Window({
                                 layout: 'fit',
                                 title:'图片',
                                 width:240,
                                 height:320,
                                 //autoHight:false,
                                 modal:true,
                                 html:"<img src='"+cn.id+"'>",
                                 closeAction:'hide'          
                            });
                    showPic.show();

                }
            }

        }
    })
});

[/code]

是不是那个tpl有问题?
显示没问题。。就是点击链接没反应

  • 写回答

1条回答 默认 最新

  • lizhiyezi 2010-10-12 14:52
    关注

    主要是DataView内置处理click事件 阻止了浏览器默认行为处理事件,所以点击a标签没反应

    beforeclick : function(d, i, item, e) {
    if (String(e.getTarget().nodeName).toUpperCase() == 'A') { // 如果点击的是a标签,不进行处理。
    return false;
    }
    },

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的