pro-components icon indicating copy to clipboard operation
pro-components copied to clipboard

🐛[BUG] - Filter in Column don't seem to work

Open SquirrelCorporation opened this issue 1 year ago • 2 comments

Hi,

Local filtering for ProTable doesn't seem to work, at least partially. I have the following columns def: https://github.com/SquirrelCorporation/SquirrelServersManager/blob/master/client/src/pages/Admin/Inventory/InventoryColumns.tsx For some reason, filtering locally with the field "IP" works, but the others don't. Am I doing something wrong or this is a bug? Screenshot 2024-06-03 at 14 33 10

  • "@ant-design/icons": "^5.3.7",
  • "@ant-design/pro-components": "^2.7.9",
  • "@ant-design/use-emotion-css": "1.0.4",
  • "@umijs/route-utils": "^4.0.1",
  • "@ant-design/charts": "^2.1.1",
  • "antd": "^5.17.4",

SquirrelCorporation avatar Jun 03 '24 12:06 SquirrelCorporation

Example of column definition:

const columns: ProColumns<API.DeviceItem>[] = [
    {
      title: 'Host ID ',
      dataIndex: 'uuid',
      valueType: 'textarea',
      hideInTable: true,
    },
    {
      title: 'IP',
      dataIndex: 'ip',
      render: (dom, entity) => {
        return (
          <a
            key={entity.uuid}
            onClick={() => {
              setCurrentRow(entity);
              setShowDetail(true);
            }}
          >
            {dom}
          </a>
        );
      },
    },
    {
      title: 'Hostname',
      dataIndex: 'hostname',
      valueType: 'textarea',
    },
    {
      title: 'Status',
      dataIndex: 'status',
      hideInForm: true,
      valueEnum: {
        0: {
          text: 'Registering',
          status: 'Warning',
        },
        1: {
          text: 'Online',
          status: 'Success',
        },
        2: {
          text: 'Down',
          status: 'Error',
        },
        3: {
          text: 'Unmanaged',
          status: 'Processing',
        },
      },
    },

SquirrelCorporation avatar Jun 06 '24 13:06 SquirrelCorporation

Continuing further my investigation and looking at the request part of ProTable, printing the filterargument { filters: true/false, onFilter: true/false} is never printing any values in the object (in this example, uuid is always null in the filter param of the request call).

SquirrelCorporation avatar Jun 11 '24 10:06 SquirrelCorporation