PDA

View Full Version : Hyperlink via Sencha Ext JS 4.1



elardev
13 Jul 2012, 6:37 AM
Hi, everyone, I'd like to know how to create an hyperlink via Ext JS. Can somebody Help ?

-------------------------------------------------

Sorry, I managed to find it :)

{
xtype: 'component',
autoEl: {
tag: 'a',
href: '/* la destination - target */',
html: '/* le texte du lien - text to display */'
}
}

sword-it
13 Jul 2012, 7:02 AM
Hi,
I have created a panel & inside that I create a anchor by overriding the el of component. Review the following code:





Ext.create('Ext.Panel', {
title: 'myPanel',
items: [
{
xtype: 'component',
autoEl: {
tag: 'a',
href: 'http://www.google.com',
html: 'Click to open google'
}
}
],
renderTo: Ext.getBody(),
height: 100,
width: 200

});

elardev
13 Jul 2012, 7:07 AM
Thank you for answering :) I'm a little lazy sometimes, but I managed to find it out thanks

anmol
27 Sep 2012, 6:06 AM
hi sword-it (http://www.sencha.com/forum/member.php?427588-sword-it),
That's a good solution to get the hyperlink.
Your solutions are always proved helpful to me.
Can you please tell me how to call any javascript function when i click to the hyperlink which you have given.
Can i write a javascript function in 'href'.
I tried 'href: 'javascript:alert('hi')''
But its not working.
Can you suggest any solution.