diff --git a/README.md b/README.md index f12af83..f967a86 100644 --- a/README.md +++ b/README.md @@ -88,9 +88,9 @@ The user can interact with the table and update the filters, but the table will ### defaultSort -`string` +`array` -The name of the column you want the table to initialize sorting by. The user can interact with the table and update the sort, but the table will use the default sort when `defaultSort` or `data` changes. +The name of the column and the order you want the table to initialize sorting by (e.g. `["Location", "desc"]`). The user can interact with the table and update the sort, but the table will use the default sort when `defaultSort` or `data` changes. ### defaultStickyColumnName diff --git a/package.json b/package.json index 0ef174e..e05b812 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.13.5", + "version": "0.14.1", "license": "MIT", "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/src/components/grid.tsx b/src/components/grid.tsx index 133bb43..d2fcbb9 100644 --- a/src/components/grid.tsx +++ b/src/components/grid.tsx @@ -527,7 +527,7 @@ export function Grid(props: GridProps) { <div tw="m-2 text-gray-200 whitespace-nowrap"> Showing {filteredData.length.toLocaleString()} {isFiltered && ` of ${data.length.toLocaleString()}`} row - {(isFiltered ? filteredData : data).length === 1 ? '' : 's'} + {data.length === 1 ? '' : 's'} × {columnNames.length.toLocaleString()} column{columnNames.length === 1 ? '' : 's'} </div> </div> diff --git a/src/components/sticky-grid.tsx b/src/components/sticky-grid.tsx index 06d7d46..dfcce35 100644 --- a/src/components/sticky-grid.tsx +++ b/src/components/sticky-grid.tsx @@ -6,7 +6,10 @@ import tw from 'twin.macro'; import { FilterValue } from '../types'; function getCellIndicies(child) { - return { row: child.props.rowIndex, column: child.props.columnIndex }; + return { + row: child?.props.rowIndex || 0, + column: child?.props.columnIndex || 0 + }; } function getShownIndicies(children) {