Tips for managing a dblclick event on a row with data in a kendo-grid while using Angular2

Currently I am working with Angular2 and TS using kendo-grid. It allows me to access the data of the clicked row, but only for a singleClick event like so:

(cellClick)="onCellClick($event.dataItem)"
.

However, there is no direct way to achieve this for a doubleClick event. The code would look something like:

(dblclick)="onDblClick(<<CANNOT_GET_ROW_DATA_HERE>>)"
.

Does anyone know how to handle a double click event without relying on cellClick, and still be able to access the exact row we are interested in?

Answer №1

It's really quite straightforward.

All you need to do is include both event listeners in your <kendo-grid> settings.

    <kendo-grid
                (cellClick)="onCellClick($event.dataItem)"
                (dblclick)="onDblClick()">

Then, in your controller:

  1. Add a new global variable:

class MyClass { clickedRowItem: myObject; ..... }

  1. Set the value from cellClick to this variable:

onCellClick(dataItem: myObject) { this.clickedRowItem = trackerId; }

  1. Execute the dblFunction using the variable as the argument:

onDblClick() { this.myFunctionToFire(this.clickedRowItem); }

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Can Javascript (PWA) be used to detect fake GPS or mock GPS in applications?

Looking for a solution to prevent users from using Fake Location tools in my PWA application that gathers absence location data. Is there a method or package in JavaScript to detect the presence of Fake GPS installed on the device? ...

Issue with Angular 2 Teamcity Error

Hey team, I'm encountering an error in TeamCity and could use some assistance. [05:40:13][Step 1/6] Update assembly versions: Scanning checkout directory for assembly information related files to update version to 12 [05:40:13][Step 1/6] scan: Search ...

Component declaration in Typescript is being rejected due to the union type not being accepted

In my current project, I'm working on a component that should accept either an onClick or a to prop. const StickyButton: React.FC< ({ onClick: MouseEventHandler } | { to: string }) & { buttonComponent?: ({ onClick: MouseEventHandler }) =& ...

Is it necessary to include explicit overlapping imports in Angular if they are already imported in the parent component?

Do you think the title needs clarification? Feel free to offer suggestions. I've noticed that my design components are ending up with a lot of imports. Some of these imports are duplicated in the component that is importing them. I'm managing to ...

Guide on transitioning an Angular 4 project created in Visual Studio 2015 to Angular 6 with Visual Studio Code

Currently, I am collaborating on an Angular 4 project that utilizes a web API in Visual Studio 2015 update 3. This project serves as an ERP solution. My goal is to enhance the project by updating it to Angular 6, with Visual Studio Code as the primary too ...

Troubleshooting Angular 2 Final Release Visual Studio - encountering issues with finding module name and incorrect module.id path leading to 404 errors

After upgrading to the Angular 2 Final Release (I am using Visual Studio 2015 and TypeScript 1.8), I noticed that my line moduleId: module.id in my components now has a red squiggly underline and displays an error saying cannot find name 'module' ...

The type of Object.values() is not determined by a union or Records

When utilizing TypeScript, the Object.values() function encounters issues in deducing the accurate type from a union of Records: type A = Record<string, number>; type B = Record<string, boolean>; function func(value: A | B) { const propert ...

The Angular module does not have any exported member named 'ButtonFillMode'

Encountering an error message stating '"@progress/kendo-angular-buttons"' has no exported member 'ButtonFillMode'. when utilizing the Kendo Editor toolbar module. Despite having installed all necessary dependencies for the Edi ...

Facing issue with local redis session not functioning as intended

I'm encountering an issue with my redis session not functioning properly when testing locally. EDIT: Additionally, I realized that it's failing to save a cookie when trying to set req.session[somekey] as undefined like so: req.session.user = u ...

Building a comprehensive project using Prisma and Next.JS in TypeScript - encountering an issue where the props "Component" and "pageProps" are deemed invalid

I'm currently in the process of developing my very first full-stack application. In this project, I have chosen to use Next.js as my React framework and Prisma as my ORM for handling database access and migrations. Once I established the connection to ...

There is no index signature in the type 'string | number | EnvType' that accepts a parameter of type 'string'

Can someone help me troubleshoot this issue with config[curr][targetEnv] ??? interface EnvType { dev: string; staging: string; production: string; } type Config = { [key: string]: number | string | EnvType; }; const config: Config = { network ...

Setting up Bootstrap 4 in VS 2017 and Angular 4

I am embarking on my initial side project and attempting to utilize the following tools: .Net Core 2 MVC Angular 4 Bootstrap 4 Visual Studio 2017 I successfully followed this tutorial to get the Angular app up and running: Although I have experience wi ...

What is the best way to permit multiple instances of a component in separate tabs without losing their individual states?

My application is equipped with a lazy loading tab system that is controlled by a service. When a user chooses an option from the navigation menu, two key actions take place : An entry is appended to the tabs array within the tab service. A new route is t ...

Retrieve a particular element from an array within a JSON object using Ionic

I am currently facing a challenge in extracting a specific array element from a JSON response that I have retrieved. While I can successfully fetch the entire feed, I am struggling to narrow it down to just one particular element. Here is what my service ...

Adding a custom button to CkEditor 5 in Angular 12: Step by step tutorial

How can I customize the toolbar in version 4 of Ckeditor 5 by adding a unique button? I have tried looking through the documentation, but have been unsuccessful in achieving my goal. ...

Cross-Origin Resource Sharing (CORS) verification for WebSocket connections

I am currently utilizing expressjs and have implemented cors validation to allow all origins. const options = { origin: ['*'], credentials: true, exposedHeaders: false, preflightContinue: false, optionsSuccessStatus: 204, methods: [&a ...

Tips for troubleshooting the error "Cannot locate module mp3 file or its associated type declarations"

https://i.sstatic.net/q4x3m.png Seeking guidance on resolving the issue with finding module './audio/audio1.mp3' or its type declarations. I have already attempted using require('./audio/audio1.mp3'), but continue to encounter an error ...

Leveraging the power of Angular4 to dynamically iterate through SVG elements with the

Currently, I am utilizing SVG for font-icons and it is performing flawlessly. However, I have encountered a significant issue while employing *ngFor in my code: <ion-col col-3 *ngFor="let land of landscape_amenities> <span class="icon-{{land. ...

Is it possible for us to integrate the Neo4j application's output into our Angular and NodeJS front-end?

Is there a way to integrate the Neo4j application output into my Angular Front-end application? I am open to using Nodejs for backend if necessary. Could you kindly provide guidance on how to specifically include just the middle section of a graph diagram ...

Testing the Angular component with service: An error occurred while trying to access the `diagnosticData` property as it was found to be undefined

Seeking guidance on angular testing as a beginner. I have encountered an issue where my component is not receiving the values during testing, even though the app functions correctly. Can someone assist me with this? I have shared the service, JSON object, ...