From 835f40b2b99f2d52b337d92d750b707c25bc6240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Merve=20=C3=96z=C3=A7if=C3=A7i?= Date: Tue, 27 Nov 2018 09:58:34 +0300 Subject: [PATCH] Fixed #641 - this.props.onSelectionChange is not a function --- src/components/datatable/DataTable.js | 7 ++++++- src/components/datatable/TableBody.js | 21 ++++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/components/datatable/DataTable.js b/src/components/datatable/DataTable.js index e4f9b99fe5..39b31345d8 100644 --- a/src/components/datatable/DataTable.js +++ b/src/components/datatable/DataTable.js @@ -747,7 +747,12 @@ export class DataTable extends Component { else selection = []; - this.props.onSelectionChange({originalEvent: event, value: selection}); + if(this.props.onSelectionChange) { + this.props.onSelectionChange({ + originalEvent: event, + value: selection + }); + } } filterLocal(value) { diff --git a/src/components/datatable/TableBody.js b/src/components/datatable/TableBody.js index e52bd30ad1..c947fcbbfd 100644 --- a/src/components/datatable/TableBody.js +++ b/src/components/datatable/TableBody.js @@ -109,7 +109,12 @@ export class TableBody extends Component { } } - this.props.onSelectionChange({originalEvent: event.originalEvent, value: selection}); + if(this.props.onSelectionChange) { + this.props.onSelectionChange({ + originalEvent: event.originalEvent, + value: selection + }); + } } } @@ -159,7 +164,12 @@ export class TableBody extends Component { } } - this.props.onSelectionChange({originalEvent: event.originalEvent, value: selection}); + if(this.props.onSelectionChange) { + this.props.onSelectionChange({ + originalEvent: event.originalEvent, + value: selection + }); + } } onCheckboxClick(event) { @@ -180,7 +190,12 @@ export class TableBody extends Component { } } - this.props.onSelectionChange({originalEvent: event.originalEvent, value: selection}); + if(this.props.onSelectionChange) { + this.props.onSelectionChange({ + originalEvent: event.originalEvent, + value: selection + }); + } } isSingleSelectionMode() {