-
25 Jan 2013 6:03 AM #1
Unanswered: Hyperlink to displayfield
Unanswered: Hyperlink to displayfield
Hi,
I have used displayfield in ExtJS to show read only values and wanted to provide hyper link so that user can navigate to other page.
Please let me know how to enable hyperlink and attach url link.
Thanks, PravinThanks, Pravin
-
25 Jan 2013 6:12 AM #2
use render listener to call a method and from the method return link as below:
function getLinkRenderer(value, obj, record) {
return '<a href ="javascript: jascriptMethod()">' + value + '</a>';
}
-
25 Jan 2013 6:12 AM #3
Try using autoEl:
PHP Code:{
xtype: 'displayfield',
value: 'Google',
autoEl: {
tag: 'a',
href: 'http://google.com',
target:'_blank'
}
}
-
29 Jan 2013 6:34 AM #4
This is NOT working over ExtJS form... can i use any other way?
Thanks, Pravin
-
29 Jan 2013 6:48 AM #5
Which is not working? Can you post your code?
-
29 Jan 2013 7:01 AM #6Sencha - Community Support Team
- Join Date
- May 2012
- Location
- Istanbul
- Posts
- 1,331
- Vote Rating
- 76
- Answers
- 124
Hi,
Try the following code-
Code:{ xtype: 'displayfield', value: '<a href ="www.google.com">Google</a>' }
sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.
-
29 Jan 2013 7:11 AM #7
your code works somehow NOT sure how to open URL in new window. I coded like -
{
xtype: 'box',
autoEl: {
tag: 'a',
href: 'http://www.google.com/',
cn: 'Google'
},
listeners: {
render: function (c) {
c.on('click', function (e) {
alert('You clicked me!');
}, c, { stopEvent: true });
}
}
}
Above code also open URL in the same window. Please let me know how can I open URL in new window.Thanks, Pravin
-
30 Jan 2013 3:15 AM #8Sencha - Community Support Team
- Join Date
- May 2012
- Location
- Istanbul
- Posts
- 1,331
- Vote Rating
- 76
- Answers
- 124
Try the below code-
Code:{ xtype: 'box', autoEl: { tag: 'a', href: 'http://www.google.com/', target: '_blank' // for open in new window cn: 'Google' },
sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.
-
30 Jan 2013 5:09 AM #9
Thanks... target='_blank' was missed out in my code and it works fine now.
I have dashboard where the list is displayed and on row click I'm opening form dialog window where I need to set display values with hyperlink which will navigate to respective record from other app.
Now the issues is when I'm opening dialog window first time; my code owrks fine... somehow next time hyperlinks displays old values... i mean the values of first time window load.
Please let me know how should I clear old values from the hyperlink and repalce with new values.. Im using following code which works fine for first time window load-
var lastIncidentNo = Ext.getCmp('lastincidentnoid');
lastIncidentNo.autoEl.cn = results.IncidentNo;
lastIncidentNo.autoEl.href = 'http://Google.com/' + results.IncidentNo;Thanks, Pravin


Reply With Quote