From b03f17b82c9aaebcfac5de07aa1aeab0e9c42055 Mon Sep 17 00:00:00 2001 From: Gervwyk Date: Thu, 7 Apr 2022 23:17:50 +0200 Subject: [PATCH] fix: Do not call onRowSelected on selected and unselected, closes #8 --- src/AgGrid.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AgGrid.js b/src/AgGrid.js index 068ef6a..161dbb3 100644 --- a/src/AgGrid.js +++ b/src/AgGrid.js @@ -75,6 +75,7 @@ class AgGrid extends React.Component { } onRowSelected(event) { + if (!event.node.selected) return; // see https://stackoverflow.com/a/63265775/2453657 if (this.props.events.onRowSelected) { this.props.methods.triggerEvent({ event: { row: event.data, selected: this.gridApi.getSelectedRows() }, @@ -100,7 +101,6 @@ class AgGrid extends React.Component { name: 'onFilterChanged', event: { rows: event.api.rowModel.rowsToDisplay.map((row) => row.data) }, }); - console.log(event); } }