Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search Box与CRUD搭配使用时,如何实现前端搜索多个字段值 #9711

Closed
LoadingZhang opened this issue Mar 3, 2024 · 1 comment
Assignees

Comments

@LoadingZhang
Copy link

CRUD开启loadDataOnce
目前Search Box只能指定一个字段,如何在前端实现多个字段,或全部字段的搜索

@CheshireJCat
Copy link
Collaborator

配置 loadDataOnceFetchOnFilter 为 false 则为前端过滤,然后给需要搜索的字段配置searchable即可联合查询
效果如下
image

{
  "type": "page",
  "body": {
    "type": "crud",
    "syncLocation": false,
    "api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample",
    "loadDataOnce": true,
    "loadDataOnceFetchOnFilter": false,
    "autoGenerateFilter": true,
    "columns": [
      {
        "name": "id",
        "label": "ID"
      },
      {
        "name": "engine",
        "label": "Rendering engine"
      },
      {
        "name": "browser",
        "label": "Browser"
      },
      {
        "name": "platform",
        "label": "Platform(s)"
      },
      {
        "name": "version",
        "label": "Engine version",
        "searchable": {
          "type": "select",
          "name": "version",
          "label": "Engine version",
          "clearable": true,
          "multiple": true,
          "searchable": true,
          "checkAll": true,
          "options": [
            "1.7",
            "3.3",
            "5.6"
          ],
          "maxTagCount": 10,
          "extractValue": true,
          "joinValues": false,
          "delimiter": ",",
          "defaultCheckAll": false,
          "checkAllLabel": "全选"
        }
      },
      {
        "name": "grade",
        "label": "CSS grade",
        "searchable": {
          "type": "select",
          "name": "grade",
          "label": "CSS grade",
          "clearable": true,
          "multiple": true,
          "searchable": true,
          "checkAll": true,
          "options": [
            "A",
            "C",
            "X"
          ],
          "maxTagCount": 10,
          "extractValue": true,
          "joinValues": false,
          "delimiter": ",",
          "defaultCheckAll": false,
          "checkAllLabel": "全选"
        }
      }
    ]
  }
}

@CheshireJCat CheshireJCat self-assigned this Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants