【extjs】 怎么给formpanel里面的img加链接

剑神一笑 2011-05-16 10:40:21
 {
xtype : 'textfield',
fieldLabel : '单位logo',
id : 'logourl',
name : 'logourl',
width : 130,
height : 60,
inputType : 'image'
}


从后台读取到图片地址显示图片
myForm.getForm().load({
url : 'order/auditOrder.do?id=' + idvalue,
waitMsg : '正在读取数据,请稍候...',
success : function(form,action){ myForm.findById('logourl').getEl().dom.src = action.result.logourl;
}
});

但是在form里面必须规定他的大小 现在想点击图片能弹出图片
就是给这个图片加个链接 该如何实现?
...全文
385 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
剑神一笑 2011-05-16
  • 打赏
  • 举报
回复
自己先顶顶
剑神一笑 2011-05-16
  • 打赏
  • 举报
回复
终于弄出来了 用上面的方法没办法得到链接
换个思路显示图片用dataview
代码如下

{
xtype : 'dataview',
fieldLabel : '广告设计',
store : new Ext.data.JsonStore({
url : 'getAttchPath.do?id='+idvalue+'&type=sheji',
root : 'root',
fields : ['attchPath', 'attchName'],
autoLoad:true
}),
tpl : new Ext.XTemplate(
'<tpl for=".">',
'<div class="ux-status-view-wrap">',
'<div class="ux-status-view-roompic"><a href={attchPath} target="_blank"><img src={attchPath} title={attchName} width="130" height = "60"></a></div>',
'</div></tpl>'),
overClass : 'x-view-over',
itemSelector : 'div.thumb-wrap',
emptyText : 'No images to display'
}
frejus 2011-05-16
  • 打赏
  • 举报
回复
注冊事件

Ext.getCmp('logourl').on('click',function (){
window.open('圖片的URL');
});
或者
{
xtype : 'textfield',
fieldLabel : '单位logo',
id : 'logourl',
name : 'logourl',
width : 130,
height : 60,
inputType : 'image'
},handler:function(){
window.open('圖片的URL');
}


注冊事件試看看點擊打開新窗口

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧