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

Doubleclick event in aspnet core grid

3 Answers 393 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matt Bowser
Top achievements
Rank 1
Veteran
Matt Bowser asked on 21 Dec 2020, 02:28 PM

I have a aspnet core grid that currently has the following code set to select the current row:

.Events( events => events.Change("onRowSelect"))

 

The function works fine and is written as:

function onRowSelect(e) {
        var row = this.dataItem(this.select());
       .... do work here
)

 

The users have added a new requirement that the event must be a doubleclick event and I'm not sure how to proceed.  Any help would be appreciated.

Thanks

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 24 Dec 2020, 07:32 AM

Hello,

If a double click is needed we must handle the event manually with javascript instead of using the 'onRowSelect' event as for example it is done it is done in the code below:

   $(document).ready(function () {
          var grid = $("#grid").data('kendoGrid');
          grid.tbody.on('dblclick', 'tr', function() {
            var dataItem = grid.dataItem($(this));
            // do whatever you like with the row data...
        	});
        });

If you need further assistance please don't hesitate to let me know.

Regards,
Plamen
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Matt Bowser
Top achievements
Rank 1
Veteran
answered on 24 Dec 2020, 12:42 PM

Thanks Plamen,

I hadn't thought about implementing via javascript, I assumed there was a built in function. 

The following code ended working for me after removing the onRowSelect event in the grid:

$('#assignAgentGrid').on('dblclick', 'tr', function () {
        var assignAgentGrid = $("#assignAgentGrid").data('kendoGrid');
        var row = assignAgentGrid.dataItem($(this));
         
        ...Do work here...
});
0
Plamen
Telerik team
answered on 25 Dec 2020, 05:26 AM

Hello,

Yes  indeed, currently there is no inbuild way. I am glad it worked correctly for you.

Regards,
Plamen
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Matt Bowser
Top achievements
Rank 1
Veteran
Answers by
Plamen
Telerik team
Matt Bowser
Top achievements
Rank 1
Veteran
Share this question
or