Search results

Open a dialog on popup item click in Vue DropDownButton component

29 Jul 2021 / 2 minutes to read

This section explains about how to open a dialog on DropdownButton popup item click. This can be achieved by handling dialog open in select event of the DropdownButton.

Install Syncfusion List packages using below command.

Copied to clipboard
npm install @syncfusion/ej2-vue-list --save

In the following example, Dialog will open while selecting Other Folder... item.

Source
Preview
app.vue
Copied to clipboard
<template>
<div>
    <ejs-dropdownbutton :items='items' iconCss='ddb-icons e-folder'cssClass='e-vertical'
    iconPosition='Top' :select='onSelect'>Move</ejs-dropdownbutton>
    <ejs-dialog id="dialog" content="Move Items To 'Web Team'" header='Move Items' :buttons='buttons' width='250px' height='150px' :visible='false' :position='position'></ejs-dialog>
 </div>
</template>

<script>
import Vue from 'vue';
import { DropDownButtonPlugin } from "@syncfusion/ej2-vue-splitbuttons";
import { DialogPlugin } from "@syncfusion/ej2-vue-popups";
import { enableRipple } from '@syncfusion/ej2-base';

enableRipple(true);
Vue.use(DropDownButtonPlugin);
Vue.use(DialogPlugin);

export default {
    data () {
        return {
            items:[
            {
                text: 'Archive'
            },
            {
                text: 'Inbox'
            },
            {
                text: 'HR Portal'
            },
            {
                separator: true
            },
            {
                text: 'Other Folder...'
            },
            {
                text: 'Copy to Folder'
            }],
            buttons: [{
                buttonModel: {
                    isPrimary: true,
                    content: 'OK',
                    cssClass: 'e-flat',
                },
                click: function () {
                    this.hide();
                }
            }],
            position: {X: 100, Y: 100}
        };
    },
    methods: {
        onSelect: function(args) {
            if (args.item.text === 'Other Folder...') {
                document.getElementById("dialog").ej2_instances[0].show();
            }
        }
    },
}
</script>

<style>
  @import '../node_modules/@syncfusion/ej2-base/styles/material.css';
  @import '../node_modules/@syncfusion/ej2-buttons/styles/material.css';
  @import '../node_modules/@syncfusion/ej2-popups/styles/material.css';
  @import '../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css';
    @font-face {
    font-family: 'e-db-icons';
    src:
    url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMj0jSR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wABBAkACgBYAO8AAwABBAkACwAkAUcgZS1kYi1pY29uc1JlZ3VsYXJlLWRiLWljb25zZS1kYi1pY29uc1ZlcnNpb24gMS4wZS1kYi1pY29uc0ZvbnQgZ2VuZXJhdGVkIHVzaW5nIFN5bmNmdXNpb24gTWV0cm8gU3R1ZGlvd3d3LnN5bmNmdXNpb24uY29tACAAZQAtAGQAYgAtAGkAYwBvAG4AcwBSAGUAZwB1AGwAYQByAGUALQBkAGIALQBpAGMAbwBuAHMAZQAtAGQAYgAtAGkAYwBvAG4AcwBWAGUAcgBzAGkAbwBuACAAMQAuADAAZQAtAGQAYgAtAGkAYwBvAG4AcwBGAG8AbgB0ACAAZwBlAG4AZQByAGEAdABlAGQAIAB1AHMAaQBuAGcAIABTAHkAbgBjAGYAdQBzAGkAbwBuACAATQBlAHQAcgBvACAAUwB0AHUAZABpAG8AdwB3AHcALgBzAHkAbgBjAGYAdQBzAGkAbwBuAC4AYwBvAG0AAAAAAgAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAQIBAwEEAQUADG1lc3NhZ2UtbWFpbAtyZWFkLXVucmVhZAZkZWxldGUAAAAAAA==) format('truetype');
    font-weight: normal;
    font-style: normal;
    }

    .ddb-icons {
    font-family: 'e-db-icons' !important;
    speak: none;
    font-size: 55px;
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    }

    .e-folder::before {
    content: '\e703';
    }
</style>