簡體   English   中英

帶有數字的 Antd tabe 過濾器

[英]Antd tabe filter with number

我想使用帶有一組數值的過濾器來過濾表,例如查找 0 或 Null 的計數antd表

這對我不起作用`

filters: [
        { text: "zero", value: 0 },
        { text: "null", value: "null" }
      ],

`

您需要插入 onFilter 函數,例如:

const columns = [
    {
      title: "Name",
      dataIndex: "name",
      key: "name"
    },
    {
      title: "Age",
      dataIndex: "age",
      key: "age",
      onFilter: (value, record) => record.age === value,
      filters: [
        {
          text: "null",
          value: null
        },
        {
          text: "0",
          value: 0
        }
      ],
      filterSearch: true,
      sortDirections: ["descend"]
    }
  ]; 

cod沙盒示例

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM