From e0695202ae2dca81d5fbecacc07ee2eab7ea9d1d Mon Sep 17 00:00:00 2001 From: Felipe Vaz Date: Thu, 10 May 2018 20:20:54 -0500 Subject: [PATCH 1/2] Adding 2 missing props on GridProps: rowActionsCell and selectAllRenderer --- types/react-data-grid/index.d.ts | 10 ++++++ .../react-data-grid/react-data-grid-tests.tsx | 31 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/types/react-data-grid/index.d.ts b/types/react-data-grid/index.d.ts index af6edce257..f66aad2e41 100644 --- a/types/react-data-grid/index.d.ts +++ b/types/react-data-grid/index.d.ts @@ -203,6 +203,16 @@ declare namespace AdazzleReactDataGrid { isSelectedKey?: string; } } + /** + * A custom formatter for the select all checkbox cell + * @default react-data-grid/src/formatters/SelectAll.js + */ + selectAllRenderer?: React.ReactElement | React.ComponentClass | React.StatelessComponent; + /** + * A custom formatter for select row column + * @default AdazzleReactDataGridPlugins.Editors.CheckboxEditor + */ + rowActionsCell?: React.ReactElement | React.ComponentClass | React.StatelessComponent; /** * An event function called when a row is clicked. * Clicking the header row will trigger a call with -1 for the rowIdx. diff --git a/types/react-data-grid/react-data-grid-tests.tsx b/types/react-data-grid/react-data-grid-tests.tsx index 827e20c820..8c0feb8f64 100644 --- a/types/react-data-grid/react-data-grid-tests.tsx +++ b/types/react-data-grid/react-data-grid-tests.tsx @@ -31,6 +31,35 @@ class CustomFilterHeaderCell extends React.Component { } } +class CustomRowSelectorCell extends ReactDataGridPlugins.Editors.CheckboxEditor { + render(){ + return super.render(); + } +} + +export interface ICustomSelectAllProps { + onChange: any; + inputRef: any; +} + +class CustomSelectAll extends React.Component { + render() { + return ( +
+ + +
+ ); + } +} + faker.locale = 'en_GB'; function createFakeRowObjectData(index:number):Object { @@ -327,6 +356,8 @@ class Example extends React.Component { keys: {rowKey: 'id', values: selectedRows} } }} + rowActionsCell={CustomRowSelectorCell} + selectAllRenderer={CustomSelectAll} onRowClick={this.onRowClick} /> From 473658826f852bd5051e4b30dc1879e2c0c24f2d Mon Sep 17 00:00:00 2001 From: Felipe Nunes Vaz Date: Fri, 11 May 2018 08:25:59 -0500 Subject: [PATCH 2/2] Fixed PR comments --- types/react-data-grid/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-data-grid/index.d.ts b/types/react-data-grid/index.d.ts index f66aad2e41..82070c673c 100644 --- a/types/react-data-grid/index.d.ts +++ b/types/react-data-grid/index.d.ts @@ -207,12 +207,12 @@ declare namespace AdazzleReactDataGrid { * A custom formatter for the select all checkbox cell * @default react-data-grid/src/formatters/SelectAll.js */ - selectAllRenderer?: React.ReactElement | React.ComponentClass | React.StatelessComponent; + selectAllRenderer?: React.ComponentClass | React.StatelessComponent; /** * A custom formatter for select row column * @default AdazzleReactDataGridPlugins.Editors.CheckboxEditor */ - rowActionsCell?: React.ReactElement | React.ComponentClass | React.StatelessComponent; + rowActionsCell?: React.ComponentClass | React.StatelessComponent; /** * An event function called when a row is clicked. * Clicking the header row will trigger a call with -1 for the rowIdx.