add default sort props (#114294)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
e8d16cddca
commit
328da6f720
|
@ -9,6 +9,7 @@ import { useState, useCallback } from 'react';
|
|||
import { EuiTableSortingType } from '@elastic/eui';
|
||||
import { euiTableStorageGetter, euiTableStorageSetter } from '../../components/table';
|
||||
import { Storage } from '../../../../../../src/plugins/kibana_utils/public';
|
||||
import { EUI_SORT_ASCENDING } from '../../../common/constants';
|
||||
|
||||
interface Pagination {
|
||||
pageSize: number;
|
||||
|
@ -77,7 +78,9 @@ export function useTable(storageKey: string) {
|
|||
);
|
||||
|
||||
// get initial state from localStorage
|
||||
const [sorting, setSorting] = useState<Sorting>(storageData.sort || { sort: {} });
|
||||
const [sorting, setSorting] = useState<Sorting>(
|
||||
storageData.sort || { sort: { field: 'name', direction: EUI_SORT_ASCENDING } }
|
||||
);
|
||||
|
||||
const [query, setQuery] = useState('');
|
||||
|
||||
|
|
Loading…
Reference in a new issue