Reputation: 23
I am using Ag-grid in Angular 8 project. I have got stuck at one function call where i am using ag-grid's double click event. When cellDoubleClicked event gets fire, i am calling one method. But its calling that method twice if I quickly double click the grid's cell. But it works fine in slow down my mouse double clicking speed. What i did so far is in TS file declared the method and put console log. also i have put event in html and assigned callback function.
In my.Component.html file
<ag-grid-angular>
[columnDef] = "columnDef"
[rowData] = "rowData"
(gridReady) = "onGridReady($event)"
(cellClicked) = "onCellClicked($event)"
(cellDoubleClicked) = "onCellDoubleClicked($event)"
</ag-grid-angular>
In my.Component.ts file
IMPORTS GOES HERE...
export class MyComponent implements OnInit {
OTHER LOGIC GOES HERE...
onCellDoubleClicked($event){
console.log("method called"); //This will be called 2 times if you fast/quickly double click the cell. It should call once only
}
}
Upvotes: 1
Views: 6285
Reputation: 23
This was the Ag-Grid framework issue itself. The issue has been fixed in Ag-Grid version 22.1.0. You might face this mouse double click issue if your Ag-Grid version is lower than 22.1.0. So, Make sure if you are planning to upgrade to version 23.xx then follow this migration guide from ag-grid. Please visit the link below and search for onCellDoubleClicked to see ag-grid's changelog link: https://www.ag-grid.com/ag-grid-changelog/
Upvotes: 1