PDA

View Full Version : Grid Column as an Link



Supial
20 Feb 2012, 7:48 PM
Greetings,
I have a grid column that uses a custom renderer which renders the data as a link (<a href...>). When the grid column is displayed however, it's width doesn't seem to be rendered properly and the data is cut off. The grid is using ForceFit, but even when this is the only column, it is not displayed correctly.
Below is a snippet of the column renderer:


return Ext.String.format('<a href={0} title={1} >{2}</a>', myUrl, 'Some Title', 'My Data');


Is there some CSS class that I need to use on the Anchor tag? Any idea why this is occuring?

Cheers,

skirtle
20 Feb 2012, 9:15 PM
I suspect the main problem is that you're missing double-quotes on your attributes:


return Ext.String.format('<a href="{0}" title="{1}">{2}</a>', myUrl, 'Some Title', 'My Data');

Personally I would also run the values through Ext.util.Format.htmlEncode to ensure they're escaped correctly.

Supial
21 Feb 2012, 9:48 PM
The missing quotes was a type-o in the example. The real code did enclose the attribute values in quotes. I also ensured that all values where encoded using the Ext.util.Format.htmlEncode method.

But...no change. The column with the link is still not resizing correctly.

Cheers

skirtle
22 Feb 2012, 1:14 AM
It works fine for me.

Which ExtJS version are you using?

Are you able to provide a complete test case with static data? Or maybe a screenshot of the problem?