将extjs与jquery结合的问题
Issue with combining extjs with jquery
我尝试将jquery与extjs一起使用。当我点击一个图像时,我希望获得该图像的id并将其存储在一个变量中。这部分我使用jquery。该图像位于extjs面板中。我使用没有结果和后渲染侦听器以下是我的代码:
items: [{
xtype: 'tabpanel',
width: 600,
activeTab: 0,
flex: 2,
layout: {type: 'fit'},
items: [{
xtype: 'panel',
title: 'Images',
items: [{contentEl:'img',autoScroll:true,height:500 }],
listeners: {afterrender: function(c){c.el.on('click', function()
{
$('img').on( 'click',function() { // event delegation
var idImg = $(this).attr('id');
alert(idImg);
addMarker(idImg)
var alt = $(this).attr('alt'); // get the value of alt
$('#curInterId').val(alt); // place the internal id in the text box
});
});}},
},{
xtype: 'panel',
title: 'Material',
items: [{contentEl:'msg',autoScroll:true,height:500 }]
}]
}],renderTo : Ext.getBody()
},
试试这样的东西:
Fiddle Link
Ext.application({
name: 'Fiddle',
launch: function() {
Ext.create("Ext.panel.Panel", {
layout: "fit",
renderTo: Ext.getBody(),
items: [{
xtype: 'panel',
title: 'Images',
items: [{
xtype: 'image',
height: 200,
width: 600,
src: 'http://www.newbridgegreen.com/assets/bootstrap/img/sencha_logo.png',
listeners: {
el: {
click: function() {
Ext.Msg.alert("Message");
}
}
}
}]
}]
});
}
});
这里的关键是el:在侦听器中,可以使用此方法向任何元素添加标准DOM单击处理程序。
相关文章:
- 在指令控制器中使用$attrs时出现问题
- javascript结合了数组和字典
- 将PHP变量传递给jQuery时遇到问题
- Canvas Html5绘图应用程序,移动画布会导致重大问题
- 参数变量出现ngTable指令问题
- 剑道网格jQuery动画()问题
- 我的jQuery插件参数没有正确启动,遇到了问题
- 将Firebase与Electron结合使用
- Phonegap-(安卓/iphone)多个图像的图像库出现问题
- 结合jQuery和jetpack无限滚动
- 将extjs与jquery结合的问题
- Lightswitch HTML5图像上传(IOS设备)旋转问题(结合2个Java脚本)
- 将窗格拆分器和jstree与Javascript结合使用时出现问题
- 与jquery结合使用时的Javascript循环问题
- img的onclick属性与setInterval结合使用时出现问题
- jquery 与 .click() 和 .hover() 结合使用切换的问题
- 结合jQuery对话框和选项卡时的高度问题
- extjs4.2 与 asp.net MVC 结合使用时的 setPath 问题
- 面临敲除结合的问题
- 结合fanybox和tinyMCE问题