Filter

Using selectpickers to filter the table below.

1. filters

{
    "label": "Chain of Custody",
    "icon": "mdi mdi-link-variant",
    "url_name": "grid_chain_of_custody",
    "children": None,
    "allowed_user_groups": [
        "grp-chain-of-custody-rw",
        "grp-chain-of-custody-r",
    ],
    "allowed_users": [],
    "view": controller_views.GridView,
    "view_params": {
        "title": "Chain of Custody",
        "selectpickers_columns": 4,
        "selectpickers": [
            {
                "name": "supplier_id",
                "label": "Factory/Facility Name",
                "category": "filter",
                "live_search": True,
                "action_box": True,
                "multiple": True,
                "queryset": {
                    "model": custom_models.Supplier,
                    "value_field": "id",
                    "label_field": "name",
                },
            },
            ....
        ],
    },
},

The parameters in the selecpickers are:

  • name: The field name in the model

  • label: The label shown in the selectpickers in automail

  • category: filter category

  • multiple: Whether multiple choices are allowed in the filters

  • queryset: Provided the model details.

Last updated