-
27 Dec 2012 7:33 AM #1
Answered: how to show url link in grid column
Answered: how to show url link in grid column
I have a textfield saved in database that can contains a string value like this:
I want to show this field inside a grid column, but converting the "http://....." in a url link (<a href =".....)Code:some text bla bla bla http://www.google.com some more text bla bla alb ala bla
Is it possible ?-------------------
Manel Juàrez
-
Best Answer Posted by maneljn
i've found this solution. It works very well.
https://github.com/cowboy/javascript-linkify/
-
27 Dec 2012 11:15 AM #2
Just use a renderer function on the column:
http://docs.sencha.com/ext-js/4-1/#!...n-cfg-renderer
You can return whatever HTML you want.
-
28 Dec 2012 12:46 AM #3
Yes Skirtle, i know the use of renderer, but my question is how can i "detect" that inside the text are strings like http://...... , and how can i make substitution of this string adding the html tags for url link <a href=.......
Manel-------------------
Manel Juàrez
-
28 Dec 2012 1:02 AM #4
Identifying URLs in text isn't really an ExtJS question but I guess you could do something using a regular expression:
You'll have to do some experimenting to refine the expression to pick out exactly what you want.Code:renderer: function(value) { return value.replace(/(https?:\/\/\S+)/g, '<a href="$1">$1</a>'); }
-
4 Jan 2013 3:16 AM #5
-------------------
Manel Juàrez


Reply With Quote