File tree Expand file tree Collapse file tree 3 files changed +11
-13
lines changed
Expand file tree Collapse file tree 3 files changed +11
-13
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " frame-one-table" ,
3- "version" : " 0.3.8 " ,
3+ "version" : " 0.3.9 " ,
44 "description" : " A react table with maximum flexibility." ,
55 "main" : " build/index.js" ,
66 "module" : " build/index.es.js" ,
Original file line number Diff line number Diff line change @@ -92,6 +92,11 @@ export interface ColumnOption<T = any> {
9292 */
9393 headerValue ?: any ;
9494
95+ /**
96+ * Implement custom sorting for your smart table column
97+ */
98+ onSort ?: ( ) => void ;
99+
95100 /**
96101 * Format function to run the values for the column's body cells through before displaying them (ie. (height) => height + "cm"). Does not modify the value used to compare for sorting the column
97102 */
@@ -162,11 +167,6 @@ export interface TableGeneratorProps {
162167 */
163168 paginatorProps : IPaginatorProps ;
164169
165- /**
166- * Implement custom sorting for your smart table
167- */
168- onSort ?: ( ) => void ;
169-
170170 /**
171171 * Hide or show the header row. Defaults true
172172 */
@@ -286,7 +286,6 @@ export const TableGenerator: React.FC<TableGeneratorProps> = (props) => {
286286 columnOptions = { props . columnOptions }
287287 headerClassName = { props . headerClassName }
288288 headerStyle = { props . headerStyle }
289- onSort = { props . onSort }
290289 />
291290 ) }
292291
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import {ColumnOption, TableGeneratorProps} from "./TableGenerator";
33import { CellContextDetails } from "./contextTypes" ;
44
55export interface ITableHeaderProps extends Partial < TableGeneratorProps > {
6- onSort ?( ) : void ;
76}
87
98const TableHeader : React . FC < ITableHeaderProps > = ( props ) => {
@@ -31,10 +30,14 @@ const TableHeader: React.FC<ITableHeaderProps> = (props) => {
3130 content = column . headerRender ( column . headerValue , cellContextDetails ) ;
3231 }
3332
33+ function onSortHelper ( ) : void {
34+ column . onSort ?.( ) ;
35+ }
36+
3437 return (
3538 < th
39+ onClick = { onSortHelper }
3640 style = { column . headerCellStyle }
37- onClick = { props . onSort }
3841 >
3942 { content }
4043 </ th >
@@ -53,8 +56,4 @@ const TableHeader: React.FC<ITableHeaderProps> = (props) => {
5356 ) ;
5457} ;
5558
56- TableHeader . defaultProps = {
57- onSort : ( ) => { } ,
58- } ;
59-
6059export default TableHeader ;
You can’t perform that action at this time.
0 commit comments