summary text localStorage
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import {useMemo, useState} from 'react';
|
||||
import {MaterialReactTable} from 'material-react-table';
|
||||
import useTableSetting from "@/lib/hooks/useTableSetting";
|
||||
import {Typography} from "@mui/material";
|
||||
|
||||
|
||||
const data = [
|
||||
@@ -56,7 +57,7 @@ const TestDataTable = () => {
|
||||
const [userId, setUserId] = useState(2);
|
||||
const [pageName, setPageName] = useState('loan');
|
||||
const [tableName, setTableName] = useState('loan_table');
|
||||
const {settingStore, hideAction, filterAction, sortAction, oldSorting} = useTableSetting();
|
||||
const {settingStore, hideAction, filterAction, sortAction,} = useTableSetting();
|
||||
|
||||
const columns = useMemo(
|
||||
() => [
|
||||
@@ -147,21 +148,26 @@ const TestDataTable = () => {
|
||||
sortAction(userId, pageName, tableName, settingValue, columns);
|
||||
}
|
||||
|
||||
return <MaterialReactTable
|
||||
columns={columns}
|
||||
data={data}
|
||||
manualSorting={true}
|
||||
initialState={{
|
||||
columnVisibility: settingStore?.[userId]?.[pageName]?.[tableName]?.['hides'],
|
||||
sorting: settingStore?.[userId]?.[pageName]?.[tableName]?.['sorts'] || []
|
||||
}}
|
||||
state={{
|
||||
columnVisibility: settingStore?.[userId]?.[pageName]?.[tableName]?.['hides'],
|
||||
sorting: settingStore?.[userId]?.[pageName]?.[tableName]?.['sorts'] || []
|
||||
}}
|
||||
onColumnVisibilityChange={onColumnVisibilityChange}
|
||||
onSortingChange={onSortingChange}
|
||||
/>;
|
||||
return (
|
||||
<>
|
||||
<Typography>{settingStore?.[userId]?.[pageName]?.[tableName]?.['summary']}</Typography>
|
||||
<MaterialReactTable
|
||||
columns={columns}
|
||||
data={data}
|
||||
manualSorting={true}
|
||||
initialState={{
|
||||
columnVisibility: settingStore?.[userId]?.[pageName]?.[tableName]?.['hides'],
|
||||
sorting: settingStore?.[userId]?.[pageName]?.[tableName]?.['sorts'] || []
|
||||
}}
|
||||
state={{
|
||||
columnVisibility: settingStore?.[userId]?.[pageName]?.[tableName]?.['hides'],
|
||||
sorting: settingStore?.[userId]?.[pageName]?.[tableName]?.['sorts'] || []
|
||||
}}
|
||||
onColumnVisibilityChange={onColumnVisibilityChange}
|
||||
onSortingChange={onSortingChange}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default TestDataTable;
|
||||
|
||||
Reference in New Issue
Block a user