Reputation: 75
I simply want to add a hyper link in my application. I tried the following code and the link is appearing in the page. But the on click event is not working. Can anyone please tell me what might be the reason?
xtype:'box',
isFormField: true,
id: "prospectStageLink",
style: "padding: 3px",
autoEl:{
//html: ' <a href>Link To Prospect</a>'
tag: 'a',
href: '#',
cn: 'Link To Prospect'
},
listeners: {
render: function(c){
c.on('click', function(e){
alert('clicked', 'hiii');
}, c, { stopEvent: true });
}
}
Upvotes: 2
Views: 8256
Reputation: 1497
xtype:'box',
isFormField: true,
id: "prospectStageLink",
style: "padding: 3px",
autoEl:{
//html: ' <a href>Link To Prospect</a>'
tag: 'a',
href: '',
onClick: 'nameYouFunction'
}
Upvotes: 0
Reputation: 2216
try this :
listeners: {
render: function(component) {
component.getEl().on('click', function(e) {
alert('test');
});
}
}
Upvotes: 2
Reputation: 8608
I assume you are not running on ExtJS 4, because BoxComponent was removed from it.
Anyways, the simple explanation is probably that BoxComponent does not have a click
event. You might want to try using an Element instead, which does have support for the click
event.
Upvotes: 0