Doubleclick event in aspnet core grid

4 posts, 0 answers
  1. Matt Bowser
    Matt Bowser avatar
    8 posts
    Member since:
    Sep 2006

    Posted 21 Dec 2020 Link to this post

    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

  2. Plamen
    Admin
    Plamen avatar
    3079 posts

    Posted 24 Dec 2020 Link to this post

    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/.

  3. Matt Bowser
    Matt Bowser avatar
    8 posts
    Member since:
    Sep 2006

    Posted 24 Dec 2020 Link to this post

    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...
    });
  4. Plamen
    Admin
    Plamen avatar
    3079 posts

    Posted 24 Dec 2020 Link to this post

    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/.

Back to Top