根据 material-table 中的查找编号排序反应

sorting on basis of lookup number in material-table react

我想将优先级列排序为“立即”、“紧急”、“高”等等,但我只能根据字母进行升序或降序排序, 但我想根据查找数

进行排序
{ 
  title: "priority", 
  field:"priority",
  lookup: { 1: 'Immediate', 2: 'Urgent', 3: 'High', 4: 'Normal', 5: 'Low' },
}

这里是 link material-table 排序文档 https://material-table.com/#/docs/features/sorting

所以我想通了

{ title: "priority", field:"priority",
  // lookup: { 1: 'Immidiate', 2: 'Urgent', 3: 'High', 4: 'Normal', 5: 'Low' },
  render: 
    rowData => 
    rowData.priority == "1" ? <Badge variant="danger">Immidiate</Badge>:
    rowData.priority == "2" ? <Badge variant="warning">Urgent</Badge> : 
    rowData.priority == "3" ? <Badge variant="warning">High</Badge> : 
    rowData.priority == "4" ? <Badge variant="primary">Normal</Badge>:
    rowData.priority == "5" ? <Badge variant="secondary">Low</Badge>:
    <Badge variant="dark">{rowData.priority}</Badge>
},

我删除了查找并像这样渲染它