我想重置列排序:
import * as React from 'react';
import Box from '@mui/material/Box';
import { DataGridPro } from '@mui/x-data-grid-pro';
import { useDemoData } from '@mui/x-data-grid-generator';
export default function DataGridProDemo() {
const { data } = useDemoData({
dataSet: 'Commodity',
rowLength: 100000,
editable: true,
});
const resetOrdering = () => {
// I need to get ordering state and reset it by default
}
return (
<Box sx={{ height: 520, width: '100%' }}>
<button onClick={resetOrdering} > Reset </button>
<DataGridPro
{...data}
loading={data.rows.length === 0}
rowHeight={38}
checkboxSelection
disableSelectionOnClick
experimentalFeatures={{ newEditingApi: true }}
/>
</Box>
);
}
字符串
我曾尝试使用与Data Grid Pro API分离的setter,但这对我没有帮助。
1条答案
按热度按时间xcitsw881#
试试这个:
字符串