PDA

View Full Version : [OPEN] [#459] Request for Hyperlink Column



jchau
Mar 27, 2014, 2:48 PM
I think it would be great if there's a built in hyperlink column for gridpanels. While it is easy to override the renderer to create a hyperlink per cell, I find that hacky because I dont want to assign an onclick to each hyperlink inside the renderer. The other alternative is to listen to grid cellclick event, check for column clicked, and override cell css to make it look like a hyperlink. But it would be nice to be able to wrap all that inside a hyperlink column that's very similar to your commandcolumn.

geoffrey.mcgill
Mar 27, 2014, 4:45 PM
We will discuss. Thanks for the great suggestion.

geoffrey.mcgill
Mar 27, 2014, 4:46 PM
I've created a new Issue to track this request:

https://github.com/extnet/Ext.NET/issues/459

Vladimir
Mar 28, 2014, 1:26 AM
As quick solution I can suggest to use ImageCommandColumn



<ext:ImageCommandColumn runat="server" Width="170">
<Commands>
<ext:ImageCommand CommandName="Delete" Text="<a href='#'>Delete</a>" Cls="hyper-command">
<ToolTip Text="Delete" />
</ext:ImageCommand>
<ext:ImageCommand CommandName="Edit" Text="<a href='#'>Edit</a>" Cls="hyper-command">
<ToolTip Text="Edit" />
</ext:ImageCommand>
</Commands>


div.hyper-command span
{
padding-left:5px !important;
}

Daniil
Mar 28, 2014, 1:49 AM
I find that hacky because I dont want to assign an onclick to each hyperlink inside the renderer.

You should not do that if you use an <a> HTML element. Do you not want to use <a> elements?

I think a TemplateColumn might be a good option as well.

geoffrey.mcgill
Mar 28, 2014, 3:05 AM
You should not do that if you use an <a> HTML element. Do you not want to use <a> elements?

I think a TemplateColumn might be a good option as well.

Yes, there fairly easy alternatives, but I think the original point is valid and a dedicated HyperlinkColumn would be very nice to have.

Daniil
Mar 28, 2014, 3:14 AM
Yes, I got it. I am rather thinking how to implement. I guess it should be similar to a LinkButton which renders an <a> HTML element.

Daniil
Apr 10, 2014, 10:45 PM
@jchau, I would like to elaborate on your requirement.

Please clarify do you need exactly what Vladimir suggested?

As quick solution I can suggest to use ImageCommandColumn



<ext:ImageCommandColumn runat="server" Width="170">
<Commands>
<ext:ImageCommand CommandName="Delete" Text="<a href='#'>Delete</a>" Cls="hyper-command">
<ToolTip Text="Delete" />
</ext:ImageCommand>
<ext:ImageCommand CommandName="Edit" Text="<a href='#'>Edit</a>" Cls="hyper-command">
<ToolTip Text="Edit" />
</ext:ImageCommand>
</Commands>


div.hyper-command span
{
padding-left:5px !important;
}

jchau
Apr 10, 2014, 11:00 PM
@jchau, I would like to elaborate on your requirement.

Please clarify do you need exactly what Vladimir suggested?

Yup, that would work great. I didn't use an <a> at first because I still have to assign a javascript function to run when you click on the link.

Daniil
Apr 10, 2014, 11:11 PM
I still have to assign a javascript function to run when you click on the link.

It might be done via ImageCommandColumn's Command Listener. Does it suite your needs?

Daniil
May 28, 2014, 8:38 AM
The HyperlinkColumn has been implemented and committed to v3 in the revision 5856. There is an example as well.

I will review it just before v3.0 release to ensure it is still working.