ant-design / pro-components

🏆 Use Ant Design like a Pro!
https://pro-components.antdigital.dev
MIT License
4.31k stars 1.36k forks source link

🧐[问题] EditableProTable QueryFilter ignoreRules not working. #4610

Closed xXAvoraXx closed 2 years ago

xXAvoraXx commented 2 years ago

I am fetching table data from model. That's why query filtering doesn't work. For this, I plan to place the data from model state in the request feature of the table, but in query filtering, it gets stuck on the fields I don't want and the rules I set on the form. How can I fix ?

const {tableData} = useModel('tables');

        form={{
          ignoreRules: true
        }}
        request={async (params, sorter, filter: any) => ({
           data: tableData.filter(filter),
           total: 3,
           success: true,
         })}
chenshuai2144 commented 2 years ago

try this code

       const {tableData} = useModel('tables');
       const tableDataRef = useRef(tableData);
       form={{
          ignoreRules: true,
        }}
        request={async (params, sorter, filter: any) => ({
          data: tableDataRef.current.filter(filter),
          total: 3,
          success: true,
        })}
xXAvoraXx commented 2 years ago

try this code

       const {tableData} = useModel('tables');
       const tableDataRef = useRef(tableData);
       form={{
          ignoreRules: true,
        }}
        request={async (params, sorter, filter: any) => ({
          data: tableDataRef.current.filter(filter),
          total: 3,
          success: true,
        })}

ignoreRules: true, not work.

chenshuai2144 commented 2 years ago

is lastest version ?

xXAvoraXx commented 2 years ago

is lastest version ?

{
  "name": "ant-design-pro",
  "version": "5.2.0",
  "private": true,
  "description": "An out-of-box UI solution for enterprise applications",
  "dependencies": {
    "@ant-design/icons": "^4.7.0",
    "@ant-design/pro-card": "^1.18.26",
    "@ant-design/pro-descriptions": "^1.10.0",
    "@ant-design/pro-form": "^1.52.0",
    "@ant-design/pro-layout": "^6.32.0",
    "@ant-design/pro-table": "^2.61.0",
    "@microsoft/signalr": "^6.0.1",
    "@types/uuid": "^8.3.4",
    "@umijs/hooks": "^1.9.3",
    "@umijs/route-utils": "^2.0.0",
    "antd": "^4.17.0",
    "classnames": "^2.3.0",
    "currency-list": "^1.0.6",
    "lodash": "^4.17.0",
    "moment": "^2.29.0",
    "moment-timezone": "^0.5.34",
    "omit.js": "^2.0.2",
    "rc-menu": "^9.1.0",
    "rc-util": "^5.16.0",
    "react": "^17.0.0",
    "react-dev-inspector": "^1.7.0",
    "react-dom": "^17.0.0",
    "react-helmet-async": "^1.2.0",
    "umi": "^3.5.0",
    "uuid": "^8.3.2",
  },
  "devDependencies": {
    "@ant-design/pro-cli": "^2.1.0",
    "@playwright/test": "^1.17.0",
    "@types/express": "^4.17.0",
    "@types/history": "^4.7.0",
    "@types/jest": "^26.0.0",
    "@types/lodash": "^4.14.0",
    "@types/react": "^17.0.0",
    "@types/react-dom": "^17.0.0",
    "@types/react-helmet": "^6.1.0",
    "@umijs/fabric": "^2.8.0",
    "@umijs/openapi": "^1.3.0",
    "@umijs/plugin-blocks": "^2.2.0",
    "@umijs/plugin-esbuild": "^1.4.0",
    "@umijs/plugin-openapi": "^1.3.0",
    "@umijs/preset-ant-design-pro": "^1.3.0",
    "@umijs/preset-dumi": "^1.1.0",
    "@umijs/preset-react": "^1.8.17",
    "@umijs/yorkie": "^2.0.5",
    "carlo": "^0.9.46",
    "cross-env": "^7.0.0",
    "cross-port-killer": "^1.3.0",
    "detect-installer": "^1.0.0",
    "enzyme": "^3.11.0",
    "eslint": "^7.32.0",
    "express": "^4.17.0",
    "gh-pages": "^3.2.0",
    "jsdom-global": "^3.0.0",
    "lint-staged": "^10.0.0",
    "mockjs": "^1.1.0",
    "prettier": "^2.5.0",
    "puppeteer-core": "^8.0.0",
    "stylelint": "^13.0.0",
    "swagger-ui-react": "^3.52.0",
    "typescript": "^4.5.0",
    "umi-serve": "^1.9.10"
  },
}
xXAvoraXx commented 2 years ago

How can I add your changes to my project?

Is there any code like this 'postinstall, lint etc'?