This is a migrated thread and some comments may be shown as answers.

Row click and double click events

9 Answers 2106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 1
Nick asked on 04 Jul 2019, 02:31 PM

Hi,

Does the grid support click/double click events or is there any way I can support it on a given column. I'm building the columns dynamically as I am binding to custom types. The grid is only ever in read-only mode. I also have some columns that have anchors/links in them which is working fine. But when I double click anywhere other than a link I want to do an action using the context of the row.

 

Thanks,

Nick.

9 Answers, 1 is accepted

Sort by
0
Nick
Top achievements
Rank 1
answered on 04 Jul 2019, 05:14 PM
I have gotten around this by implementing a row template and using ondblclick on the <td> elements!
0
Marin Bratanov
Telerik team
answered on 08 Jul 2019, 03:26 PM
Hi Nick,

At the moment, such events are not available and the solution you found is the way to do this. Of course, using a column template may also suffice if you want this action only for certain columns and not for the entire row.

That said, a few hours before your request we received another that was literally the same, so I made this page so you can Follow the implementation of such events: https://feedback.telerik.com/blazor/1417387-row-click-and-double-click-events. Your vote is already in.


Regards,
Marin Bratanov
Progress Telerik UI for Blazor
0
Andriy
Top achievements
Rank 1
answered on 12 Jul 2019, 06:12 PM
Tell me please, how I can use your controls without so important events? It's not about grid only. For example, what about TreeView? User clicks on node element and want to see the data in right part. Where I can take info about clicked node if you don't provide any event?
0
Andriy
Top achievements
Rank 1
answered on 12 Jul 2019, 09:37 PM

I found solution for TreeView, may be it will be usefull for Grid also.
Full fragment:
<TelerikTreeView @ref="TreeView" Data="@TreeItems">
                    <TelerikTreeViewBindings>
                        <TelerikTreeViewBinding IdField="Id" ParentIdField="TopId" ExpandedField="IsExpanded" TextField="ItemName" HasChildrenField="HasChildren">
                            <ItemTemplate Context="item">
                                @{
                                    var inventoryTreeItem = item as InventoryTreeItemProxy;
                                }
                                <span @key=@inventoryTreeItem.Id @onclick=@((e) => OnTreeItemClick(e, inventoryTreeItem))><strong>@inventoryTreeItem.ItemName</strong></span>
                            </ItemTemplate>
                        </TelerikTreeViewBinding>
                    </TelerikTreeViewBindings>
                </TelerikTreeView>

As a temporary solution will works.

0
Marin Bratanov
Telerik team
answered on 15 Jul 2019, 08:28 AM
Hi Andriy,

Templates in Blazor are much more powerful than templates in MVC or jQuery, because there is no longer such a great distinction between a server and a client and rendering on each. At the moment, using templates to wire up events like click, doubleclick, mouseover and so on is the correct approach. We are still considering whether it will make sense to expose them explicitly through our components, because, on the other hand, the usage of custom templates is likely to break built-in events by removing the markup we attach handlers internally.

That said, feel free to add a public feature request for events you don't see yet in our feedback portal (use the "Request a Feature" button at the top right hand corner, and make sure to select the "make public" ckecbox in the final step): https://feedback.telerik.com/blazor. We incorporate community feedback in our planning extensively and we try to add popular requests as soon as possible.


Regards,
Marin Bratanov
Progress Telerik UI for Blazor
0
Andriy
Top achievements
Rank 1
answered on 15 Jul 2019, 11:09 AM
Hi, Marin.
Thank you very much for your answer.
0
Marin Bratanov
Telerik team
answered on 17 Jul 2019, 01:38 PM
Hello Andriy,

We just received another request for a built-in click event and I made now a public page you can Follow for status updates: https://feedback.telerik.com/blazor/1418731-node-click-event. I've already added your vote so all you need to do is click Follow. I can't say at this point whether using templates will remain the preferred approach in the future, but you can get notifications from that page.


Regards,
Marin Bratanov
Progress Telerik UI for Blazor
0
hazelinesnow
Top achievements
Rank 1
answered on 06 May 2020, 09:30 AM

For blazor grid, we prefer "whole row" double click event, instead of using ondblclick on the <td> elements as Nick suggested. 

For example, the following:

https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/client-side-programming/events/onrowdblclick

Thanks

0
Marin Bratanov
Telerik team
answered on 06 May 2020, 09:57 AM

Hello,

At the moment, it is likely that click and doubleClick events will be exposed for the row, and if a specific cell needs a click - that would be handled through its own template.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Grid
Asked by
Nick
Top achievements
Rank 1
Answers by
Nick
Top achievements
Rank 1
Marin Bratanov
Telerik team
Andriy
Top achievements
Rank 1
hazelinesnow
Top achievements
Rank 1
Share this question
or