Adding 2 missing props on GridProps: rowActionsCell and selectAllRenderer

This commit is contained in:
Felipe Vaz 2018-05-10 20:20:54 -05:00
parent 8cd6bba3b3
commit e0695202ae
2 changed files with 41 additions and 0 deletions

View File

@ -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<any> | React.ComponentClass<any> | React.StatelessComponent<any>;
/**
* A custom formatter for select row column
* @default AdazzleReactDataGridPlugins.Editors.CheckboxEditor
*/
rowActionsCell?: React.ReactElement<any> | React.ComponentClass<any> | React.StatelessComponent<any>;
/**
* An event function called when a row is clicked.
* Clicking the header row will trigger a call with -1 for the rowIdx.

View File

@ -31,6 +31,35 @@ class CustomFilterHeaderCell extends React.Component<any, any> {
}
}
class CustomRowSelectorCell extends ReactDataGridPlugins.Editors.CheckboxEditor {
render(){
return super.render();
}
}
export interface ICustomSelectAllProps {
onChange: any;
inputRef: any;
}
class CustomSelectAll extends React.Component<ICustomSelectAllProps> {
render() {
return (
<div className='react-grid-checkbox-container checkbox-align'>
<input
className='react-grid-checkbox'
type='checkbox'
name='select-all-checkbox'
id='select-all-checkbox'
ref={this.props.inputRef}
onChange={this.props.onChange}
/>
<label htmlFor='select-all-checkbox' className='react-grid-checkbox-label'></label>
</div>
);
}
}
faker.locale = 'en_GB';
function createFakeRowObjectData(index:number):Object {
@ -327,6 +356,8 @@ class Example extends React.Component<any, any> {
keys: {rowKey: 'id', values: selectedRows}
}
}}
rowActionsCell={CustomRowSelectorCell}
selectAllRenderer={CustomSelectAll}
onRowClick={this.onRowClick}
/>