我正在使用material-table (mbrn/material-table)开发一个仪表板,我有一个列包含兆字节(MB)和千兆字节(GB)的内存值。由于文件大小不同,常规排序选项无法按预期工作。material-table中是否有自定义排序功能来对文件大小(MB和GB)进行排序?
https://github.com/mbrn/material-table.git
在github存储库上面,我用来开发仪表板。
发布于 2021-08-13 13:02:46
不能,但您可以编写一个自定义逻辑来在几秒钟内创建您自己的筛选器。
// your logic
const sortBySize() = (row, value) => {
console.log('row', row, 'value', value);
}
const columns = [
{ title: "File name", field: "fileName" },
{ title: "size", field: "size", customSort: sortBySize() }
];有用链接:https://material-table.com/#/docs/features/sorting (自定义排序算法示例)
https://stackoverflow.com/questions/68772695
复制相似问题