---
title: Filtering and Searching in Dynamic Panel
product: Form Library
description: Search and filter entries in a Dynamic Panel with the SurveyJS Filter control. Try text search, quick filters, and saved filters in a JavaScript demo.
framework: Vue 3
source: https://surveyjs.io/form-library/examples/filtering-in-dynamic-panel/vue3js
index: https://surveyjs.io/form-library/examples/overview.md
---

# Filtering and Searching in Dynamic Panel (Vue 3)

A Filter control narrows down the entries shown in a [Dynamic Panel](/form-library/documentation/api-reference/dynamic-panel-model). In this demo, each panel represents a workshop. Users can search by workshop or instructor, apply quick filters, and save and reuse filter presets. The **All Filters** dialog shows every configured filter field. Expand a workshop to see its instructor, track, level, and available seats.

## Add and Bind the Filter Control

Add an element with `type` set to `"filter"` and a unique `name` to your survey JSON. To bind it to a Dynamic Panel, set [`targetQuestion`](/form-library/documentation/api-reference/questionfiltermodel#targetQuestion) to the panel question's `name`. The Filter control updates which panels are visible as users search, set conditions, or select a preset.

The following example shows how to bind the Filter control to a Dynamic Panel:

```json
{
  "elements": [
    {
      "type": "filter",
      "name": "workshopFilter",
      "title": "Filter Workshops",
      "targetQuestion": "workshops"
    },
    {
      "type": "paneldynamic",
      "name": "workshops",
      "title": "Workshops",
      "templateElements": [
        { "type": "text", "name": "session", "title": "Workshop" },
        { "type": "text", "name": "instructor", "title": "Instructor" },
        // ...
      ]
    }
  ]
}
```

## Configure Filter Fields

By default, the Filter control generates fields from visible questions in the Dynamic Panel's [`templateElements`](/form-library/documentation/api-reference/dynamic-panel-model#templateElements) array. Each field inherits the question's name, title, value type, and choices, and the Filter control infers which operators are available. To customize the available fields, define the [`fields`](/form-library/documentation/api-reference/questionfiltermodel#fields) array. Each object in this array can include the following properties:

- [`name`](/form-library/documentation/api-reference/filterfield#name)\
Uniquely identifies the field and binds it to a template question. Set it to the question's `name` or `valueName`.

- [`title`](/form-library/documentation/api-reference/filterfield#title)\
Sets the localizable label users see for the field.

- [`operators`](/form-library/documentation/api-reference/filterfield#operators)\
Limits the available filter operators. See [Supported Operators](/form-library/documentation/design-survey/conditional-logic#supported-operators).

- [`showInQuickFilters`](/form-library/documentation/api-reference/filterfield#showInQuickFilters)\
Specifies whether this field is available in quick filters. If you set this property to `false`, the field will be available in **All Filters** only.

This example hides the `session` quick filter and limits the operators for `seats`.

The following code example defines two filter fields, `session` and `seats`. `session` is hidden from quick filters; `seats` contains a limited set of filter operators.

```json
{
  "elements": [
    {
      "type": "filter",
      "name": "workshopFilter",
      "title": "Filter Workshops",
      "targetQuestion": "workshops",
      "fields": [
        { "name": "session", "showInQuickFilters": false },
        { "name": "seats", "operators": ["equal", "less", "greater"] }
      ]
    },
    {
      // ...
    }
  ]
}
```

## Configure Search

The search bar is enabled by default and searches all available filter fields, including fields hidden from quick filters. Use the [`searchFields`](/form-library/documentation/api-reference/questionfiltermodel#searchFields) array to limit the search to specific fields. Make sure those fields are included in the `fields` array if you define it.

The search bar placeholder lists the searchable fields by default. Set the localizable [`searchPlaceholder`](/form-library/documentation/api-reference/questionfiltermodel#searchPlaceholder) property to customize the text.

The example below limits search to the `session` and `instructor` fields and displays a custom placeholder:

```json
{
  "elements": [
    {
      "type": "filter",
      "name": "workshopFilter",
      "title": "Filter Workshops",
      "targetQuestion": "workshops",
      "searchFields": ["session", "instructor"],
      "searchPlaceholder": "Search by workshop or instructor"
    },
    {
      // ...
    }
  ]
}
```

If you want to disable search, set the [`showSearchBar`](/form-library/documentation/api-reference/questionfiltermodel#showSearchBar) property to `false`.

## Configure Filter Presets

Filter presets let users reapply saved conditions. To define presets, use the [`presets`](/form-library/documentation/api-reference/questionfiltermodel#presets) array. Each object in this array can include the following properties:

- [`name`](/form-library/documentation/api-reference/filterpreset#name)\
Uniquely identifies the preset within the Filter control.

- [`title`](/form-library/documentation/api-reference/filterpreset#title)\
Sets the localizable label users see for the preset. The label defaults to the preset's `name`.

- [`expression`](/form-library/documentation/api-reference/filterpreset#expression)\
Determines which panels match the preset. See [Expressions](/form-library/documentation/design-survey/conditional-logic#expressions).

- [`allowEdit`](/form-library/documentation/api-reference/filterpreset#allowEdit)\
Specifies whether users can edit this preset.

- [`allowDelete`](/form-library/documentation/api-reference/filterpreset#allowDelete)\
Specifies whether users can remove this preset.

To apply a preset at startup, assign the preset's `name` set the [`defaultPreset`](/form-library/documentation/api-reference/questionfiltermodel#defaultPreset) property. The example below applies **Seats Available** when the Dynamic Panel first loads:

```json
{
  "elements": [
    {
      "type": "filter",
      "name": "workshopFilter",
      "title": "Filter Workshops",
      "targetQuestion": "workshops",
      "presets": [
        { "name": "openSeats", "title": "Seats Available", "expression": "{seats} > 0" },
        { "name": "beginner", "title": "Beginner Sessions", "expression": "{level} = 'Beginner'" }
      ],
      "defaultPreset": "openSeats"
    },
    {
      // ...
    }
  ]
}
```

Enable the [`allowAddPresets`](/form-library/documentation/api-reference/questionfiltermodel#allowAddPresets) property to let users save the current conditions as a filter preset. Users can edit and delete the presets they create without restrictions. If you also want users to edit or delete survey-defined presets, enable the [`allowEditPresets`](/form-library/documentation/api-reference/questionfiltermodel#allowEditPresets) and [`allowDeletePresets`](/form-library/documentation/api-reference/questionfiltermodel#allowDeletePresets) properties. This demo allows users to create custom presets and prevents them from editing or deleting presets defined in the survey.

## See Also

[Demo: Filtering in Matrices](/form-library/examples/filtering-in-matrices/ (linkStyle))

## Files

### `public/index.html`

```html
<link href="https://fonts.googleapis.com/css?family=Open%20Sans:400,600&display=swap" rel="stylesheet">
<div id="app" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; height:100%"></div>
```

### `src/App.vue`

```html
<template>
    <SurveyComponent :model="survey" />
</template>
<script setup lang="ts">
    import { Model } from "survey-core";
    import { SurveyComponent } from "survey-vue3-ui";
    import "survey-core/survey-core.min.css";
    import "./index.css";
    import { json } from "./json";

    const survey = new Model(json);
    survey.onComplete.add((sender, options) => {
        console.log(JSON.stringify(sender.data, null, 3));
    });
    survey.data = {
      workshops: [
        { session: "Design Systems Essentials", instructor: "Maya Chen", track: "Design", level: "Beginner", seats: 6 },
        { session: "Building Accessible Forms", instructor: "Leo Martin", track: "Development", level: "Intermediate", seats: 4 },
        { session: "Dashboard Storytelling", instructor: "Maya Chen", track: "Data", level: "Intermediate", seats: 0 },
        { session: "SQL for Beginners", instructor: "Anika Rao", track: "Data", level: "Beginner", seats: 8 },
        { session: "Advanced TypeScript", instructor: "Jonas Kim", track: "Development", level: "Advanced", seats: 0 },
        { session: "Prototyping with Components", instructor: "Elena Park", track: "Design", level: "Intermediate", seats: 3 },
        { session: "Practical Data Visualization", instructor: "Anika Rao", track: "Data", level: "Advanced", seats: 2 },
        { session: "Getting Started with Web APIs", instructor: "Jonas Kim", track: "Development", level: "Beginner", seats: 5 }
      ]
    };
    
</script>
```

### `src/index.css`

```css
/* You can add your custom CSS here. */
```

### `src/json.ts`

```ts
export const json = {
  "showNavigationButtons": false,
  "widthMode": "responsive",
  "pages": [
    {
      "name": "workshopCatalog",
      "elements": [
        {
          "type": "filter",
          "name": "workshopFilter",
          "title": "Filter Workshops",
          "targetQuestion": "workshops",
          "searchFields": [
            "session",
            "instructor"
          ],
          "allowAddPresets": true,
          "presets": [
            {
              "name": "openSeats",
              "title": "Seats Available",
              "expression": "{seats} > 0"
            },
            {
              "name": "beginner",
              "title": "Beginner Sessions",
              "expression": "{level} = 'Beginner'"
            }
          ]
        },
        {
          "type": "paneldynamic",
          "name": "workshops",
          "title": "Workshops",
          "panelsState": "collapsed",
          "templateTitle": "{panel.session}",
          "templateDescription": "{panel.track} · {panel.level} · {panel.seats} seats available",
          "noEntriesText": "No workshops match your filters.",
          "addPanelText": "Add Workshop",
          "templateElements": [
            {
              "type": "text",
              "name": "session",
              "title": "Workshop",
              "minWidth": "240px"
            },
            {
              "type": "text",
              "name": "instructor",
              "title": "Instructor",
              "minWidth": "200px",
              "startWithNewLine": false
            },
            {
              "type": "dropdown",
              "name": "track",
              "title": "Track",
              "minWidth": "180px",
              "choices": [
                "Design",
                "Development",
                "Data"
              ]
            },
            {
              "type": "dropdown",
              "name": "level",
              "title": "Level",
              "minWidth": "180px",
              "startWithNewLine": false,
              "choices": [
                "Beginner",
                "Intermediate",
                "Advanced"
              ]
            },
            {
              "type": "text",
              "name": "seats",
              "title": "Seats Available",
              "minWidth": "160px",
              "startWithNewLine": false,
              "inputType": "number"
            }
          ]
        }
      ]
    }
  ]
}
;
```

### `src/main.ts`

```ts
import { createApp } from "vue";
import App from "./App.vue";

const app = createApp(App);
app.mount("#app");
```

### `src/shims-vue.d.ts`

```ts
/* eslint-disable */
declare module "*.vue" {
    import type { DefineComponent } from "vue"
    const component: DefineComponent<{}, {}, any>
    export default component
}
```

### `src/theme.ts`

```ts
export const themeJson = {};
```

### `.babelrc`

```
{}
```

### `.eslintrc.js`

```js
module.exports = {
    root: true,
    env: {
        node: true
    },
    extends: [
        "plugin:vue/vue3-essential",
        "eslint:recommended",
        "@vue/typescript/recommended",
        "@vue/prettier",
        "@vue/prettier/@typescript-eslint"
    ],
    parserOptions: {
        ecmaVersion: 2020
    },
    rules: {
        "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
        "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off"
    },
    overrides: [
        {
            files: [
                "**/__tests__/*.{j,t}s?(x)",
                "**/tests/unit/**/*.spec.{j,t}s?(x)"
            ],
            env: {
                jest: true
            }
        }
    ]
};
```

### `babel.config.js`

```js
module.exports = {
  presets: ["@vue/cli-plugin-babel/preset"]
};
```

### `package.json`

```json
{
  "name": "surveyjs-library-vue3",
  "version": "0.1.0",
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "core-js": "^3.6.5",
    "tslib": "2.6.1",
    "vue": "^3.4.1",
    "survey-core": "latest",
    "survey-vue3-ui": "latest",
    "vue-router": "^4.0.0-0",
    "vuex": "^4.0.0-0"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^2.33.0",
    "@typescript-eslint/parser": "^2.33.0",
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-pwa": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-plugin-typescript": "~4.5.0",
    "@vue/cli-plugin-vuex": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0",
    "@vue/eslint-config-prettier": "^6.0.0",
    "@vue/eslint-config-typescript": "^5.0.2",
    "@vue/test-utils": "^2.0.0-0",
    "eslint": "^6.7.2",
    "eslint-plugin-prettier": "^3.1.3",
    "eslint-plugin-vue": "^7.0.0-0",
    "node-sass": "^4.12.0",
    "prettier": "^1.19.1",
    "sass-loader": "^8.0.2",
    "typescript": "~3.9.3"
  }
}
```

### `tsconfig.json`

```json
{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "strict": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "baseUrl": ".",
    "types": [
      "webpack-env",
      "jest"
    ],
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ],
  "exclude": [
    "node_modules"
  ]
}
```

## Other Frameworks

- [Angular](https://surveyjs.io/form-library/examples/filtering-in-dynamic-panel/angular.md)
- [React](https://surveyjs.io/form-library/examples/filtering-in-dynamic-panel/reactjs.md)
- [jQuery](https://surveyjs.io/form-library/examples/filtering-in-dynamic-panel/jquery.md)
- [Vanilla JS](https://surveyjs.io/form-library/examples/filtering-in-dynamic-panel/vanillajs.md)
