ejDropDownList

3 Aug 201824 minutes to read

The DropDownList control provides a list of options to choose an item from the list. It can including other HTML elements such as images, textboxes, check box, radio buttons, and so on.

Example

  • HTML
  • <input id="bookSelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width="100%" [(value)]="value" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './default.component.html'
    })
    export class DefaultComponent {
        data: Array<Object> = [];
        fields: Object;
        value: string;
        constructor() {
            this.data = [
                { id: 'cr1', text: 'Dodge Avenger', value: 'Dodge Avenger' },
                { id: 'cr2', text: 'Chrysler 200', value: 'Chrysler 200' },
                { id: 'cr3', text: 'Ford Focus', value: 'Ford Focus' },
                { id: 'cr4', text: 'Ford Taurus', value: 'Ford Taurus' },
                { id: 'cr5', text: 'Dazzler', value: 'Dazzler' },
                { id: 'cr6', text: 'Chevy Spark', value: 'Chevy Spark' },
                { id: 'cr7', text: 'Chevy Volt', value: 'Chevy Volt' },
                { id: 'cr8', text: 'Honda Fit', value: 'Honda Fit' },
                { id: 'cr9', text: 'Honda Cross tour', value: 'Honda Cross tour' },
                { id: 'cr10', text: 'Acura RL', value: 'Acura RL' },
                { id: 'cr11', text: 'Hyundai Elantra', value: 'Hyundai Elantra' },
                { id: 'cr12', text: 'Mazda3', value: 'Mazda3' }
            ];
            this.fields = { dataSource: this.data, text: 'text', value: 'value' };
            this.value = 'Dazzler';
        }
    }

    Requires

    • module:jQuery

    • module:jQuery.easing.1.3.js

    • module:ej.core.js

    • module:ej.data.js

    • module:ej.draggable.js

    • module:ej.dropdownlist.js

    • module:ej.checkbox.js

    • module:ej.scroller.js

    Members

    allowVirtualScrolling boolean

    The Virtual Scrolling(lazy loading) feature is used to display a large amount of data that you require without buffering the entire load of a huge database records in the DropDownList, that is, when scrolling, an AJAX request is sent to fetch some amount of data from the server dynamically. To achieve this scenario with DropDownList, set the allowVirtualScrolling to true.

    Default Value

    • false

    Example

  • HTML
  • <input id="bookSelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width="100%" [(value)]="value" [allowVirtualScrolling]="allowVirtualScrolling"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './default.component.html'
    })
    export class DefaultComponent {
        data: Array<Object> = [];
        fields: Object;
        value: string;
        allowVirtualScrolling: boolean;
        constructor() {
            this.data = [
                { id: 'cr1', text: 'Dodge Avenger', value: 'Dodge Avenger' },
                { id: 'cr2', text: 'Chrysler 200', value: 'Chrysler 200' },
                { id: 'cr3', text: 'Ford Focus', value: 'Ford Focus' },
                { id: 'cr4', text: 'Ford Taurus', value: 'Ford Taurus' },
                { id: 'cr5', text: 'Dazzler', value: 'Dazzler' },
                { id: 'cr6', text: 'Chevy Spark', value: 'Chevy Spark' },
                { id: 'cr7', text: 'Chevy Volt', value: 'Chevy Volt' },
                { id: 'cr8', text: 'Honda Fit', value: 'Honda Fit' },
                { id: 'cr9', text: 'Honda Cross tour', value: 'Honda Cross tour' },
                { id: 'cr10', text: 'Acura RL', value: 'Acura RL' },
                { id: 'cr11', text: 'Hyundai Elantra', value: 'Hyundai Elantra' },
                { id: 'cr12', text: 'Mazda3', value: 'Mazda3' }
            ];
            this.fields = { dataSource: this.data, text: 'text', value: 'value' };
            this.value = 'Dazzler';
            this.allowVirtualScrolling = true;
        }
    }

    cascadeTo string

    The cascading DropDownLists is a series of two or more DropDownLists in which each DropDownList is filtered according to the previous DropDownList’s value.

    Default Value

    • null

    Example

  • HTML
  • <input id="countrySelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="50%" [enabled]="enabled"/>
    <input id="groupSelect" ej-dropdownlist [dataSource]="groups" [fields]="group" width="50%" cascadeTo="countrySelect"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './cascadeTo.component.html'
    })
    export class cascadeToComponent {
        countries: Array<Object> = [];
    
    groups: Array<Object> = [];
    
    group: Object;
        fields: Object;   
    
    enabled: boolean;
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    this.groups = [
    
    
        { parentId: 'a', text: "Group A" },
                { parentId: 'b', text: "Group B" },
                { parentId: 'c', text: "Group C" },
                { parentId: 'd', text: "Group D" },
                { parentId: 'e', text: "Group E" }
    
    
    ];
            this.fields = { dataSource: this.countries, text: 'text', value: 'value' };
    
    
    this.group={ dataSource: this.groups, text: 'text', value: 'parentId'};
    
    
    this.enabled= false;
        }
    }

    caseSensitiveSearch boolean

    Sets the case sensitivity of the search operation. It supports both enableFilterSearch and enableIncrementalSearch property.

    Default Value

    • false

    Example

    cssClass string

    Dropdown widget’s style and appearance can be controlled based on 13 different default built-in themes.
    You can customize the appearance of the dropdown by using the cssClass property. You need to specify a class name in the cssClass property and the same class name is used before the class definitions wherever the custom styles are applied.

    Default Value

    • ””

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value" cssClass="customCss"/>
  • TS
  • import {Component} from '@angular/core';
    import { ViewEncapsulation } from '@angular/core';
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    
    styleUrls: ['./Dropdownlist.component.css'],
      encapsulation: ViewEncapsulation.None
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
        customCss: string;
    
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = { dataSource: this.countries, text: 'text', value: 'value' };
    
    
    this.customCss = "customCss";
        }
    }

    dataSource object

    This property is used to serve data from the data services based on the query provided. To bind the data to the dropdown widget, the dataSource property is assigned with the instance of the ej.DataManager.

    Default Value

    • null

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="dataManager" [fields]="fields" width="100%" [(value)]="value"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {   
    
        fields: Object;
    
    dataManager: Object;
        constructor() {        
            this.fields = {  text: 'Country' };
            this.dataManager = ej.DataManager("http://mvc.syncfusion.com/Services/Northwnd.svc/Customers");
        }
    }

    delimiterChar string

    Sets the separator when the multiSelectMode with delimiter option or checkbox is enabled with the dropdown. When you enter the delimiter value, the texts after the delimiter are considered as a separate word or query. The delimiter string is a single character and must be a symbol. Mostly, the delimiter symbol is used as comma (,) or semi-colon (;) or any other special character.

    Default Value

    • ’,’

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value" delimiterChar= ";" multiSelectMode= "delimiter"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;  
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries };       
        }
    }

    enableAnimation boolean

    The enabled Animation property uses the easeOutQuad animation to SlideDown and SlideUp the Popup list in 200 and 100 milliseconds, respectively.

    Default Value

    • false

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value" [enableAnimation]="enableAnimation"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    enableAnimation: boolean;
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries, text: 'text', value: 'value' };       
    
    
    this.enableAnimation = true;
        }
    }

    enabled boolean

    This property is used to indicate whether the DropDownList control responds to the user interaction or not. By default, the control is in the enabled mode and you can disable it by setting it to false.

    Default Value

    • true

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value" [enabled]="enable"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    enabled: boolean;
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries };       
    
    
    this.enabled = true;
        }
    }

    enableIncrementalSearch boolean

    Specifies to perform incremental search for the selection of items from the DropDownList with the help of this property. This helps in selecting the item by using the typed character.

    Default Value

    • true

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value" [enableIncrementalSearch]="enableIncrementalSearch"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    enableIncrementalSearch: boolean;
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries };       
    
    
    this.enableIncrementalSearch = true;
        }
    }

    enableFilterSearch boolean

    This property selects the item in the DropDownList when the item is entered in the Search textbox.

    Default Value

    • false

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value" [enableFilterSearch]="enableFilterSearch"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    enableFilterSearch: boolean;
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries };       
    
    
    this.enableFilterSearch = true;
        }
    }

    enableServerFiltering boolean

    The Server filtering is to perform filter action when text is typed in the search box and filtering will be done based on the collection which contains the matched item from entire datasource. Server filtering will be done based on the entire items in DataSource.

    Default Value

    • false

    Example

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width="100%" [(value)]="value" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" enableServerFiltering="enableServerFiltering" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    enableServerFiltering: boolean;
    
    itemsCount: int;
        constructor() {       
            this.fields = {   text: 'CompanyName', value: 'ContactName'};
            this.data = ej.DataManager({ url: "http://js.syncfusion.com/ejServices/Wcf/Northwind.svc/Customers/" });
    
    
    this.itemsCount= 10;
    
    
    this.enableFilterSearch= true;
            this.enableServerFiltering= true;
        }
    }

    enablePersistence boolean

    Saves the current model value to the browser cookies for state maintenance. While refreshing the DropDownList control page, it retains the model value and it is applied from the browser cookies.

    Default Value

    • false

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value" [enablePersistence]="enablePersistence"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    enablePersistence: boolean;
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},          
            ];
            this.fields = {  dataSource: this.countries };       
    
    
    this.enablePersistence = true;
        }
    }

    enablePopupResize boolean

    This enables the resize handler to resize the popup to any size.

    Default Value

    • false

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value" [enablePopupResize]="enablePopupResize"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    enablePopupResize: boolean;
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries };       
    
    
    this.enablePopupResize = true;
        }
    }

    enableRTL boolean

    Sets the DropDownList textbox direction from right to left align.

    Default Value

    • false

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value" [enableRTL]="enableRTL"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    enableRTL: boolean;
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries };       
    
    
    this.enableRTL = true;
        }
    }

    enableSorting boolean

    This property is used to sort the Items in the DropDownList. By default, it sorts the items in an ascending order.

    Default Value

    • false

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value" [enableSorting]="enableSorting"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    enableSorting: boolean;
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "India"},
               { value: 12, parentId: 'a', text: "Ukraine"},
               { value: 13, parentId: 'a', text: "Romania"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Poland"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "Algeria"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Egypt"},
               { value: 23, parentId: 'e', text: "New Zealand"},
               { value: 24, parentId: 'e', text: "Thailand"},
               { value: 25, parentId: 'e', text: "Singapore"},
               { value: 26, parentId: 'e', text: "Finland"}
            ];
            this.fields = {  dataSource: this.countries };       
    
    
    this.enableSorting = true;
        }
    }

    fields object

    Specifies the mapping fields for the data items of the DropDownList.

    Default Value

    • null

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
        constructor() {
            this.countries = [
              { text: "Algeria", flag: "flag-dz" }, 
               { text: "Argentina", flag: "flag" },
               { text: "Armenia", flag: "flag-am" }, 
               { text: "Brazil", flag: "flag-br" }
            ];
            this.fields = {   text: "text", value: "flag" };
        }
    }

    fields.groupBy string

    Used to group the items.

    fields.htmlAttributes object

    Defines the HTML attributes such as ID, class, and styles for the item.

    fields.id string

    Defines the ID for the tag.

    fields.imageAttributes string

    Defines the image attributes such as height, width, styles, and so on.

    fields.imageUrl string

    Defines the imageURL for the image location.

    fields.selected boolean

    Defines the tag value to be selected initially.

    fields.spriteCssClass string

    Defines the sprite CSS for the image tag.

    fields.tableName string

    Defines the table name for tag value or display text while rendering remote data.

    fields.text string

    Defines the text content for the tag.

    fields.value string

    Defines the tag value.

    filterType enum

    When the enableFilterSearch property value is set to true, the values in the DropDownList shows the items starting with or containing the key word/letter typed in the Search textbox.

    Name Description
    contains filter the data wherever contains search key
    startsWith filter the data based on search key present at start position

    Default Value

    • ej.FilterType.Contains

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="list" [fields]="fields" width="100%" [(value)]="value" enableFilterSearch=true filterType="Contains"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        list: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
            this.list = [
               { text: "Architecture", id:"Architecture" },       
               { text: "Biographies", id:"Biographies" },
               { text: "Business", id:"Business" }, 
               { text: "ComputerIT", id:"ComputerIT" },
               { text: "Comics", id:"Comics" },
    
    
       { text: "Cookery", id:"Cookery" },
               { text: "Fiction", id:"Fiction" }, 
               { text: "Health", id:"Health" },
               { text: "Humanities", id:"Humanities" },
    
    
       { text: "Language", id:"Language" }
            ];
            this.fields = {   text: "text", value: "id" };
        }
    }
  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="list" [fields]="fields" width="100%" [(value)]="value" enableFilterSearch=true filterType="StartsWith"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        list: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
            this.list = [
               { text: "Architecture", id:"Architecture" },       
               { text: "Biographies", id:"Biographies" },
               { text: "Business", id:"Business" }, 
               { text: "ComputerIT", id:"ComputerIT" },
               { text: "Comics", id:"Comics" },
    
    
       { text: "Cookery", id:"Cookery" },
               { text: "Fiction", id:"Fiction" }, 
               { text: "Health", id:"Health" },
               { text: "Humanities", id:"Humanities" },
    
    
       { text: "Language", id:"Language" }
            ];
            this.fields = {   text: "text", value: "id" };
        }
    }

    headerTemplate string

    Used to create visualized header for dropdown items

    Default Value

    • null

    Example

  • HTML
  • <input type="text" id="dropdown1" ej-dropdownlist [dataSource]="List" [width]="width" [headerTemplate]="header" [template]="template">
  • HTML
  • import {Component} from '@angular/core';
    import {ViewEncapsulation} from '@angular/core';
    @Component({
    selector: 'ej-app',
    templateUrl: 'app/components/dropdown/dropdown.component.html',
    styleUrls: ['app/components/dropdown/dropdown.component.css'],
    encapsulation: ViewEncapsulation.None
    })
    export class DropDownListComponent {
       
    List: Array<Object>;
        header: string;
        template: string;
        width: any;
        constructor() {
            this.List = [{
                text: "Erik Linden",
                imgId: "3",
                role: "Representative",
                country: "England"
                 }, {
                    text: "John Linden",
                    imgId: "6",
                    role: "Representative",
                    country: "Norway"
                }, {
                    text: "Louis",
                    imgId: "7",
                    role: "Representative",
                    country: "Australia"
                }, {
                    text: "Lawrence",
                    imgId: "8",
                    role: "Representative",
                    country: "India"
            }];
            this.header = "<div class='header'><span>PHOTO</span> <span>DETAILS</span></div>";
            this.template = '<div><img class="imgId" src="Employee/${imgId}.png" alt="employee"/>' + '<div class="ename"> ${text} </div><div class="role"> ${role} </div><div class="cont"> ${country} </div></div>';
            this.width = "200";
        }
    }

    Add the below css in dropdown.component.css file.

  • HTML
  • .imgId {
            margin: 0;
            padding: 3px 10px 3px 3px;
            border: 0 none;
            width: 60px;
            height: 60px;
            float: left;
        }
        
        .header {
            font-weight: bold;
            border-bottom: 1px solid #c8c8c8;
            background: #c8c8c8;
        }
        
        .header > span {
            display: inline-block;
            padding: 10px;
        }
        
        .ename {
            font-weight: bold;
            padding: 6px 3px 1px 3px;
        }
        
        .role, .cont {
            font-size: smaller;
            padding: 3px 3px -1px 0px;
        }

    height string|number

    Defines the height of the DropDownList textbox.

    Default Value

    • null

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value" height=100/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries };       
    
    
    
        }
    }

    htmlAttributes object

    It sets the given HTML attributes for the DropDownList control such as ID, name, disabled, etc.

    Default Value

    • null

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value" [htmlAttributes]="htmlAttributes"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    htmlAttributes: any;
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries };       
    
    
    this.htmlAttributes = { disabled: "disabled"};
        }
    }

    itemsCount number

    Data can be fetched in the DropDownList control by using the DataSource, specifying the number of items.

    Default Value

    • 5

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width="100%" [(value)]="value" [itemsCount] = "itemsCount"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    itemsCount: int;
    
    data: Object;
        constructor() {
            this.fields = {   text: "CompanyName" };
            this.data = ej.DataManager({ url: "http://js.syncfusion.com/ejServices/Wcf/Northwind.svc/Customers/" });
    
    
    this.itemsCount = 3;
        }
    }

    locale string

    Allows the user to set the particular country or region language for the DropDownList.

    Default Value

    • “en-US”

    Example

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width="100%" [(value)]="value" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" enableServerFiltering="enableServerFiltering" [locale]= "locale" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {    
    
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    enableServerFiltering: boolean;
    
    itemsCount: int;
        locale: string;
    
        constructor() {       
            this.fields = {   text: 'CompanyName', value: 'ContactName'};
            this.data = ej.DataManager({ url: "http://js.syncfusion.com/ejServices/Wcf/Northwind.svc/Customers/" });
    
    
    this.itemsCount= 10;
    
    
    this.enableFilterSearch= true;
            this.enableServerFiltering= true;
            this.locale="de-DE";
        }
    }

    maxPopupHeight string|number

    Defines the maximum height of the suggestion box. This property restricts the maximum height of the popup when resize is enabled.

    Default Value

    • null

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width=360 [(value)]="value" 
    enablePopupResize = true maxPopupHeight = "200px"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries, text: 'text', value: 'value' };       
    
    
    
        }
    }

    minPopupHeight string|number

    Defines the minimum height of the suggestion box. This property restricts the minimum height of the popup when resize is enabled.

    Default Value

    • null

    Example

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" enableServerFiltering="enableServerFiltering" enablePopupResize=true minPopupHeight= "150px" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    enableServerFiltering: boolean;
    
    itemsCount: int;
        query: any;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
            this.enableServerFiltering= true;
        }
    }

    maxPopupWidth string|number

    Defines the maximum width of the suggestion box. This property restricts the maximum width of the popup when resize is enabled.

    Default Value

    • null

    Example

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" enableServerFiltering="enableServerFiltering" enablePopupResize=true maxPopupWidth= "500px" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    enableServerFiltering: boolean;
    
    itemsCount: int;
        query: any;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
            this.enableServerFiltering= true;
        }
    }

    minPopupWidth string|number

    Defines the minimum height of the suggestion box. This property restricts the minimum height of the popup when resize is enabled.

    Default Value

    • 0

    Example

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" enableServerFiltering="enableServerFiltering" enablePopupResize=true minPopupWidth= "150px" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    enableServerFiltering: boolean;
    
    itemsCount: int;
        query: any;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
            this.enableServerFiltering= true;
        }
    }

    multiSelectMode enum

    With the help of this property, you can make a single or multi selection with the DropDownList and display the text in two modes, delimiter and visual mode. In delimiter mode, you can separate the items by using the delimiter character such as comma (,) or semi-colon (;) or any other special character. In the visual mode, the items are showcased like boxes with close icon in the textbox.

    Name Description
    none can select only single item in DropDownList
    delimiter can select multiple items and it's separated by delimiterChar
    visualMode can select multiple items and it's show's like visual box in textbox

    Default Value

    • ej.MultiSelectMode.None

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value" multiSelectMode="VisualMode"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries, text: 'text', value: 'value' };       
    
    
    
        }
    }
  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value" multiSelectMode="VisualMode"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries, text: 'text', value: 'value' };       
    
    
    
        }
    }

    popupHeight string|number

    Defines the height of the suggestion popup box in the DropDownList control.

    Default Value

    • “152px”

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value" popupHeight="190px"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries, text: 'text', value: 'value' };       
    
    
    
        }
    }

    popupWidth string|number

    Defines the width of the suggestion popup box in the DropDownList control.

    Default Value

    • “auto”

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value" popupWidth=200 />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries, text: 'text', value: 'value' };       
    
    
    
        }
    }

    query object

    Specifies the query to retrieve the data from the DataSource.

    Default Value

    • null

    Example

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    itemsCount: int;
        query: any;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
        }
    }

    readOnly boolean

    Specifies that the DropDownList textbox values should be read-only.

    Default Value

    • false

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width=360 [(value)]="value" [readOnly]="readOnly"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    readOnly: boolean;
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries, text: 'text', value: 'value' };       
    
    
    this.readOnly = true;
        }
    }

    selectedIndex number

    Specifies an item to be selected in the DropDownList.

    Default Value

    • null

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="100%" [(value)]="value" selectedIndex=2 />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries, text: 'text', value: 'value' };       
    
    
    
        }
    }

    selectedIndices array

    Specifies the selectedItems for the DropDownList.

    Default Value

    • []

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width=360 [(value)]="value" multiSelectMode="Delimiter" showCheckbox=true [selectedIndices]="selectedIndices" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    selectedIndices: array;
    
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries, text: 'text', value: 'value' };       
    
    
    this.selectedIndices = [0,1,3];
        }
    }

    showCheckbox boolean

    Selects multiple items in the DropDownList with the help of the checkbox control. To achieve this, enable the showCheckbox option to true.

    Default Value

    • false

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width=360 [(value)]="value" multiSelectMode="Delimiter" showCheckbox=true />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries, text: 'text', value: 'value' };
        }
    }

    showPopupOnLoad boolean

    DropDownList control is displayed with the popup seen.

    Default Value

    • false

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width=360 [(value)]="value" multiSelectMode="Delimiter" [showPopupOnLoad]="showPopupOnLoad"  />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
        showPopupOnLoad: boolean;
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries, text: 'text', value: 'value' };
            this.showPopupOnLoad = true;
        }
    }

    showRoundedCorner boolean

    DropDownList textbox displayed with the rounded corner style.

    Default Value

    • false

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width=360 [(value)]="value" multiSelectMode="Delimiter" [showRoundedCorner]="showRoundedCorner"  />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
        showRoundedCorner: boolean;
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries, text: 'text', value: 'value' };
            this.showRoundedCorner = true;
        }
    }

    sortOrder enum

    When the enableSorting property value is set to true, this property helps to sort the items either in ascending or descending order

    Name Description
    Ascending Sort the data in ascending order
    Descending Sort the data in descending order

    Default Value

    • ej.SortOrder.Ascending

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width=360 [(value)]="value" multiSelectMode="Delimiter" [enableSorting]="enableSorting" sortOrder="Descending" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
        enableSorting: boolean;
    
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries, text: 'text', value: 'value' };
            this.enableSorting = true;
        }
    }

    targetID string

    Specifies the targetID for the DropDownList’s items.

    Default Value

    • null

    Example

  • HTML
  • <input id="List" ej-dropdownlist [targetID]="list" />
    <div id="tools">
    
    <ul>
    
    
    <li><div class="mailtools categorize"></div>Categorize and Move</li>
    
    
    <li><div class="mailtools done"></div>Done</li>
    
    
    <li><div class="mailtools flag"></div>Flag & Move</li>
    
    
    <li><div class="mailtools forward"></div>Forward</li>
    
    
    <li><div class="mailtools movetofolder"></div>Move to Folder</li>
    
    
    <li><div class="mailtools newmail"></div>New E-mail</li>
    
    
    <li><div class="mailtools meeting"></div>New Meeting</li>
    
    
    <li><div class="mailtools reply"></div>Reply & Delete</li>
    
    </ul>
    </div>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        list: string;
    
        
        constructor() {
            this.list = "tools";
        }
    }

    template string

    By default, you can add any text or image to the DropDownList item. To customize the item layout or to create your own visualized elements, you can use this template support.

    Default Value

    • null

    Example

  • HTML
  • <input type="text" id="dropdown1" ej-dropdownlist [dataSource]="List" [width]="width" [headerTemplate]="header" [template]="template">
  • HTML
  • import {Component} from '@angular/core';
    import {ViewEncapsulation} from '@angular/core';
    @Component({
    selector: 'ej-app',
    templateUrl: 'app/components/dropdown/dropdown.component.html',
    styleUrls: ['app/components/dropdown/dropdown.component.css'],
    encapsulation: ViewEncapsulation.None
    })
    export class DropDownListComponent {
       
    List: Array<Object>;
        header: string;
        template: string;
        width: any;
        constructor() {
            this.List = [{
                text: "Erik Linden",
                imgId: "3",
                role: "Representative",
                country: "England"
                 }, {
                    text: "John Linden",
                    imgId: "6",
                    role: "Representative",
                    country: "Norway"
                }, {
                    text: "Louis",
                    imgId: "7",
                    role: "Representative",
                    country: "Australia"
                }, {
                    text: "Lawrence",
                    imgId: "8",
                    role: "Representative",
                    country: "India"
            }];
            this.header = "<div class='header'><span>PHOTO</span> <span>DETAILS</span></div>";
            this.template = '<div><img class="imgId" src="Employee/${imgId}.png" alt="employee"/>' + '<div class="ename"> ${text} </div><div class="role"> ${role} </div><div class="cont"> ${country} </div></div>';
            this.width = "200";
        }
    }

    Add the below css in dropdown.component.css file.

  • HTML
  • .imgId {
            margin: 0;
            padding: 3px 10px 3px 3px;
            border: 0 none;
            width: 60px;
            height: 60px;
            float: left;
        }
        
        .header {
            font-weight: bold;
            border-bottom: 1px solid #c8c8c8;
            background: #c8c8c8;
        }
        
        .header > span {
            display: inline-block;
            padding: 10px;
        }
        
        .ename {
            font-weight: bold;
            padding: 6px 3px 1px 3px;
        }
        
        .role, .cont {
            font-size: smaller;
            padding: 3px 3px -1px 0px;
        }

    text string

    Defines the text value that is displayed in the DropDownList textbox.

    For the single selection mode, the selected item’s text will be returned in its data type. In case of MultiSelectMode, returns the selected item’s texts and separated by delimiterChar in string type.

    Default Value

    • null

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width=360 [(value)]="value" multiSelectMode="Delimiter" [text]="text"  />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
        text: string;
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  dataSource: this.countries, text: 'text', value: 'value' };
            this.text = "Norway";
        }
    }

    validationMessage object

    Sets the jQuery validation error message in the DropDownList

    Default Value

    • null

    Example

  • HTML
  • <form id="form1">
    <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340  [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" enableServerFiltering="enableServerFiltering" enablePopupResize=true minPopupWidth= "150px" />
    <div><br/>
    <input type="submit" value="Validate">
     </div>
    </form>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    enableServerFiltering: boolean;
    
    itemsCount: int;
        query: any;
         validRule: any;
    
    validMessage: any;
    
        constructor() {
            $.validator.setDefaults({
            ignore: [],// To include hidden input validation.
            errorClass: 'e-validation-error', // to get the error message on jquery validation
            errorPlacement: function (error, element) {
                $(error).insertAfter(element.closest(".e-widget"));
            }
        });       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
            this.enableServerFiltering= true;
            this.validRule={
            required: true,
            };
            this.validMessage={
            required: "Required DDL value",
            };
        }
    }

    validationRules object

    Sets the jQuery validation rules in the Dropdownlist.

    Default Value

    • null

    Example

  • HTML
  • <form id="form1">
    <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340  [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" enableServerFiltering="enableServerFiltering" enablePopupResize=true minPopupWidth= "150px" />
    <div><br/>
    <input type="submit" value="Validate">
     </div>
    </form>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    enableServerFiltering: boolean;
    
    itemsCount: int;
        query: any;
         validRule: any;
    
    validMessage: any;
    
        constructor() {
            $.validator.setDefaults({
            ignore: [],// To include hidden input validation.
            errorClass: 'e-validation-error', // to get the error message on jquery validation
            errorPlacement: function (error, element) {
                $(error).insertAfter(element.closest(".e-widget"));
            }
        });       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
            this.enableServerFiltering= true;
            this.validRule={
            required: true,
            };
            this.validMessage={
            required: "Required DDL value",
            };
        }
    }

    value string|number

    Specifies the value (text content) for the DropDownList control.

    For the single selection mode, the selected item’s value will be returned in its data type. In case of MultiSelectMode, returns the selected item’s values and separated by delimiterChar in string type.

    Default Value

    • null

    Example

  • HTML
  • <input id="List" ej-dropdownlist [targetID]="list" [value]="value" />
    <div id="tools">
    
    <ul>
    
    
    <li><div class="mailtools categorize"></div>Categorize and Move</li>
    
    
    <li><div class="mailtools done"></div>Done</li>
    
    
    <li><div class="mailtools flag"></div>Flag & Move</li>
    
    
    <li><div class="mailtools forward"></div>Forward</li>
    
    
    <li><div class="mailtools movetofolder"></div>Move to Folder</li>
    
    
    <li><div class="mailtools newmail"></div>New E-mail</li>
    
    
    <li><div class="mailtools meeting"></div>New Meeting</li>
    
    
    <li><div class="mailtools reply"></div>Reply & Delete</li>
    
    </ul>
    </div>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        list: string;
    
        value: string;
        constructor() {
            this.list = "tools";
            this.value = "Reply & Delete";
        }
    }

    watermarkText string

    Specifies a short hint that describes the expected value of the DropDownList control.

    Default Value

    • null

    Example

  • HTML
  • <input id="List" ej-dropdownlist [targetID]="list" watermarkText="Select" />
    <div id="tools">
    
    <ul>
    
    
    <li><div class="mailtools categorize"></div>Categorize and Move</li>
    
    
    <li><div class="mailtools done"></div>Done</li>
    
    
    <li><div class="mailtools flag"></div>Flag & Move</li>
    
    
    <li><div class="mailtools forward"></div>Forward</li>
    
    
    <li><div class="mailtools movetofolder"></div>Move to Folder</li>
    
    
    <li><div class="mailtools newmail"></div>New E-mail</li>
    
    
    <li><div class="mailtools meeting"></div>New Meeting</li>
    
    
    <li><div class="mailtools reply"></div>Reply & Delete</li>
    
    </ul>
    </div>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        list: string;
    
        
        constructor() {
            this.list = "tools";
        }
    }

    width string|number

    Defines the width of the DropDownList textbox.

    Default Value

    • null

    Example

  • HTML
  • <input id="List" ej-dropdownlist [targetID]="list" watermarkText="Select" width=500 />
    <div id="tools">
    
    <ul>
    
    
    <li><div class="mailtools categorize"></div>Categorize and Move</li>
    
    
    <li><div class="mailtools done"></div>Done</li>
    
    
    <li><div class="mailtools flag"></div>Flag & Move</li>
    
    
    <li><div class="mailtools forward"></div>Forward</li>
    
    
    <li><div class="mailtools movetofolder"></div>Move to Folder</li>
    
    
    <li><div class="mailtools newmail"></div>New E-mail</li>
    
    
    <li><div class="mailtools meeting"></div>New Meeting</li>
    
    
    <li><div class="mailtools reply"></div>Reply & Delete</li>
    
    </ul>
    </div>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        list: string;
    
        
        constructor() {
            this.list = "tools";
        }
    }

    virtualScrollMode enum

    The Virtual Scrolling feature is used to display a large amount of records in the DropDownList, that is, when scrolling, an AJAX request is sent to fetch some amount of data from the server dynamically. To achieve this scenario with DropDownList, set the allowVirtualScrolling to true. You can set the itemsCount property that represents the number of items to be fetched from the server on every AJAX request.

    This property enables the data to load dynamically in two ways.

    Name Description
    normal The data is loaded only to the corresponding page (display items). When scrolling some other position, it enables the load on demand with the DropDownList.
    continuous The data items are loaded from the remote when scroll handle reaches the end of the scrollbar like infinity scrolling.

    Default Value

    • “normal”

    Example - Normal mode

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" virtualScrollMode="continuous" [itemsCount]="itemsCount" [allowVirtualScrolling]="allowVirtualScrolling" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    itemsCount: int;
        query: any;
        allowVirtualScrolling: boolean;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount = 40;
    
    
    this.enableFilterSearch = true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
            this.allowVirtualScrolling = true;
        }
    }

    Methods

    addItem(data)

    Adding a single item or an array of items into the DropDownList allows you to specify all the field attributes such as value, template, image URL, and HTML attributes for those items.Grouping and sorting will not be supported when we add items through this method.

    Name Type Description
    data object|array this parameter should have field attributes with respect to mapped field attributes and it's corresponding values to fields

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" />
    <button (click)="add()">add</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
        newCountries: Array<Object> = [];
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    this.newCountries=[
    
    
    {value: 27, parentId: 'a', text: "Iceland"},
    
    
    
    {value: 28, parentId: 'a', text: "Malaysia"},
    
    
    
    ];
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    add(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
    
    obj.addItem(this.newCountries);
    
    
    
    }
    }

    checkAll()

    This method is used to select all the items in the DropDownList.

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" [showCheckbox]="showCheckBox" multiSelectMode="VisualMode" />
    <button (click)="CheckAll()">CheckAll</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
        showCheckBox: boolean;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
            this.fields = {  text: "text", value: "value" };
            this.showCheckBox = true;
    
    
        }
    
    CheckAll(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
    
    obj.checkAll());
    
    
    
    }
    }

    clearText()

    Clears the text in the DropDownList textbox.

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 />
    <button (click)="ClearText()">ClearText</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    ClearText(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
    
    obj.clearText());
    
    
    
    }
    }
  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 />
    <button (click)="ClearText()">ClearText</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    ClearText(){
    
    
    
    
    $("#countriesSelect").ejDropDownList("clearText");
        }
    }

    destroy()

    Destroys the DropDownList widget.

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 />
    <button (click)="Destroy()">Destroy</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    Destroy(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
    
    obj.destroy());
    
    
    
    }
    }
  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 />
    <button (click)="Destroy()">Destroy</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    Destroy(){
    
    
    
    
    $("#countriesSelect").ejDropDownList("destroy");
        }
    }

    disable()

    This property is used to disable the DropDownList widget.

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 />
    <button (click)="Disable()">Disable</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    Disable(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
    
    obj.disable();
    
    
    
    }
    }
  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 />
    <button (click)="Disable()">Disable</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    Disable(){
    
    
    
    
    $("#countriesSelect").ejDropDownList("disable");
        }
    }

    disableItemsByIndices(index)

    This property disables the set of items in the DropDownList.

    Name Type Description
    index string|number|array disable the given index list items

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" />
    <button (click)="DisableItemsByIndices()">DisableItemsByIndices</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    DisableItemsByIndices(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
    
    obj.disableItemsByIndices("0,3,6");
    
    
    
    }
    }
  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" />
    <button (click)="DisableItemsByIndices()">DisableItemsByIndices</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    DisableItemsByIndices(){
    
    
    
    
    $("#countriesSelect").ejDropDownList("disableItemsByIndices","0,4,1");
        }
    }

    enable()

    This property enables the DropDownList control.

    Example

  • HTML
  • <input id="List" ej-dropdownlist [targetID]="list" enabled=false watermarkText="Select" width=500 />
    <div id="tools">
    
    <ul>
    
    
    <li><div class="mailtools categorize"></div>Categorize and Move</li>
    
    
    <li><div class="mailtools done"></div>Done</li>
    
    
    <li><div class="mailtools flag"></div>Flag & Move</li>
    
    
    <li><div class="mailtools forward"></div>Forward</li>
    
    
    <li><div class="mailtools movetofolder"></div>Move to Folder</li>
    
    
    <li><div class="mailtools newmail"></div>New E-mail</li>
    
    
    <li><div class="mailtools meeting"></div>New Meeting</li>
    
    
    <li><div class="mailtools reply"></div>Reply & Delete</li>
    
    </ul>
    </div>
    <button (click)="Enable()">Enable</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        list: string;
    
        
        constructor() {
            this.list = "tools";
        }
        Enable(){
    
    
    
    
    var obj=$("#List").data("ejDropDownList");
    
    
    obj.enable();
    
    
    
    }
    }
  • HTML
  • <input id="List" ej-dropdownlist [targetID]="list" enabled=false watermarkText="Select" width=500 />
    <div id="tools">
    
    <ul>
    
    
    <li><div class="mailtools categorize"></div>Categorize and Move</li>
    
    
    <li><div class="mailtools done"></div>Done</li>
    
    
    <li><div class="mailtools flag"></div>Flag & Move</li>
    
    
    <li><div class="mailtools forward"></div>Forward</li>
    
    
    <li><div class="mailtools movetofolder"></div>Move to Folder</li>
    
    
    <li><div class="mailtools newmail"></div>New E-mail</li>
    
    
    <li><div class="mailtools meeting"></div>New Meeting</li>
    
    
    <li><div class="mailtools reply"></div>Reply & Delete</li>
    
    </ul>
    </div>
    <button (click)="Enable()">Enable</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        list: string;
    
        constructor() {
            this.list = "tools";
        }
        Enable(){
            $("#List").ejDropDownList("enable");
        }
    }

    enableItemsByIndices(index)

    Enables an Item or set of Items that are disabled in the DropDownList

    Name Type Description
    index string|number|array enable the given index list items if it's disabled

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" (create)="OnLoading()" />
    <button (click)="EnableItemsByIndices()">EnableItemsByIndices</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
        OnLoading(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
    
    obj.disableItemsByIndices("0,1,2");
    
    }
    
    EnableItemsByIndices(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
    
    obj.EnableItemsByIndices(0,1,2));
    
    
    
    }
    }
  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" (create)="OnLoading()" />
    <button (click)="EnableItemsByIndices()">EnableItemsByIndices</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
        OnLoading(){
    
    
    
    
    var obj=$("#dropdown1").data("ejDropDownList");
    
    
    $("#countriesSelect").ejDropDownList("disableItemsByIndices","0,1,2");
    
    }
    
    EnableItemsByIndices(){
    
    
    
    
    $("#countriesSelect").ejDropDownList("enableItemsByIndices","0,1,2");
        }
    }

    getItemDataByValue(value)

    This method retrieves the items using given value.

    Name Type Description
    value string|number|object Return the whole object of data based on given value

    ####Returns: Array

    This method will return the whole object corresponds to given value from datasource

    Example

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" />
    <button (click)="GetItemDataByValue()">GetItemDataByValue</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    itemsCount: int;
        query: any;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
        }
        GetItemDataByValue(){
    
    
    var obj=$('#countriesSelect').ejDropDownList("getItemDataByValue","INDIA");
    
    
    console.log("Target ShipName - "+ obj[0].ShipName);
    
    }
    }
  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" />
    <button (click)="GetItemDataByValue()">GetItemDataByValue</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    itemsCount: int;
        query: any;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
        }
        GetItemDataByValue(){
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
    
    console.log("Target ShipName - "+ obj.getItemDataByValue("INDIA")[0].ShipName);
    
    }
    }

    getListData()

    This method is used to retrieve the items that are bound with the DropDownList.

    ####Returns:

    object

    This method will return the whole data which binds with Dropdownlist control

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 />
    <button (click)="GetListData()">GetListData</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    GetListData(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
    
    var items = obj.getListData();
    
    
    for (var i=0;i< items.length; i++)
    
    
        console.log("item" + i + " is " + items[i].text);
    
    
    
    }
    }
  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 />
    <button (click)="GetListData()">GetListData</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    GetListData(){
    
    
    
    
    var items = $("#countriesSelect").ejDropDownList("getListData");
            for (var i=0;i< items.length; i++)
    
    
        console.log("item" + i + " is " + items[i].text);
        }
    }

    getSelectedItem()

    This method is used to get the selected items in the DropDownList.

    ####Returns: Array

    This method will return the selected item elements

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" text="Romania" />
    <button (click)="GetSelectedItem()">GetSelectedItem</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    GetSelectedItem(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
    
    obj.getSelectedItem();
    
    
    }
    }
  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" text="Romania" />
    <button (click)="GetSelectedItem()">GetSelectedItem</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    GetSelectedItem(){
    
    
    
    
    $("#countriesSelect").ejDropDownList("getSelectedItem");
        }
    }

    getSelectedValue()

    This method is used to retrieve the items value that are selected in the DropDownList.

    Returns: string

    This method will return the selected Item value and separated by delimiterChar in multi selection mode.

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" text="Romania" />
    <button (click)="GetSelectedValue()">GetSelectedValue</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    GetSelectedValue(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
        obj.getSelectedValue();
    
    
    }
    }
  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" text="Romania" />
    <button (click)="GetSelectedValue()">GetSelectedValue</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    GetSelectedValue(){
    
    
    
    
    $("#countriesSelect").ejDropDownList("getSelectedValue");
        }
    }

    hidePopup()

    This method hides the suggestion popup in the DropDownList.

    Example

  • HTML
  • <button (click)="HidePopup()">HidePopup</button>
    <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" text="Romania" showPopupOnLoad=true />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    HidePopup(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
        obj.hidePopup();
    
    
    }
    }
  • HTML
  • <button (click)="HidePopup()">HidePopup</button>
    <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" text="Romania" showPopupOnLoad=true />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    HidePopup(){
    
    
    
    
    $("#countriesSelect").ejDropDownList("hidePopup");
        }
    }

    selectItemsByIndices(indices)

    This method is used to select the list of items in the DropDownList through the Index of the items.

    Name Type Description
    index string|number|array select the given index list items

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" [showCheckbox]="showCheckBox"/>
    <button (click)="SelectItemByIndex()">SelectItemByIndex</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    showCheckBox: boolean;
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    this.showCheckBox = true;
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    SelectItemByIndex(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
        obj.selectItemByIndex("0,1,2");
    //selectItemByIndices for not the DropDownList text.
    
    }
    }
  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" [showCheckbox]="showCheckBox" />
    <button (click)="SelectItemByIndex()">SelectItemByIndex</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    showCheckBox: boolean;
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    this.showCheckBox = true;
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    SelectItemByIndex(){
    
    
    
    
    $("#countriesSelect").ejDropDownList("selectItemByIndex",[0,1,2]); //selectItemByIndices for not the DropDownList text.
        }
    }

    selectItemByText(text)

    This method is used to select an item in the DropDownList by using the given text value.

    Name Type Description
    index string|number|array select the list items relates to given text

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" [showCheckbox]="showCheckBox"/>
    <button (click)="SelectItemByText()">SelectItemByText</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    showCheckBox: boolean;
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    this.showCheckBox = true;
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    SelectItemByText(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
        obj.selectItemByText("New Zealand, Poland");
    
    
    }
    }
  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" [showCheckbox]="showCheckBox" />
    <button (click)="SelectItemByText()">SelectItemByText</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    showCheckBox: boolean;
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    this.showCheckBox = true;
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    SelectItemByText(){
    
    
    
    
    $("#countriesSelect").ejDropDownList("selectItemByText","New Zealand, Poland");
        }
    }

    selectItemByValue(value)

    This method is used to select an item in the DropDownList by using the given value.

    Name Type Description
    index string|number|array select the list items relates to given values

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" [showCheckbox]="showCheckBox"/>
    <button (click)="SelectItemByValue()">SelectItemByValue</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    showCheckBox: boolean;
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    this.showCheckBox = true;
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    SelectItemByValue(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
        obj.selectItemByValue("22,20");
    
    
    }
    }
  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" [showCheckbox]="showCheckBox" />
    <button (click)="SelectItemByValue()">SelectItemByValue</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    showCheckBox: boolean;
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    this.showCheckBox = true;
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    SelectItemByValue(){
    
    
    
    
    $("#countriesSelect").ejDropDownList("selectItemByValue","20,21");
        }
    }

    showPopup()

    This method shows the DropDownList control with the suggestion popup.

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 />
    <button (click)="ShowPopup()">ShowPopup</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    showPopup(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
    
    obj.showPopup();
    
    
    
    }
    }
  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 />
    <button (click)="ShowPopup()">ShowPopup</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    ShowPopup(){
    
    
    
    
    $("#countriesSelect").ejDropDownList("showPopup");
        }
    }

    unCheckAll()

    This method is used to unselect all the items in the DropDownList.

    Example

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" />
    <input type="checkbox" id="tbutton" ej-togglebutton (change)="onCheckUncheckAll($event)"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
       fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    itemsCount: int;
        query: any;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
        }
    
    onCheckUncheckAll(event) {
            var dropdownObj = $('#CompanySelect').data("ejDropDownList");
            if (event.target.checked) dropdownObj.checkAll();
            else dropdownObj.unCheckAll();
        }
    }
  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" />
    <input type="checkbox" id="tbutton" ej-togglebutton (change)="onCheckUncheckAll($event)"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    itemsCount: int;
        query: any;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
        }
    
    onCheckUncheckAll(event) {
            if (event.target.checked) $('#CompanySelect').ejDropDownList("checkAll");
            else $('#CompanySelect').ejDropDownList("unCheckAll");
        }
    }

    unselectItemsByIndices(indices)

    This method is used to unselect the list of items in the DropDownList through Index of the items.

    Name Type Description
    index string|number|array unselect the given index list items

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" [showCheckbox]="showCheckBox" [selectedIndex]="selectedIndices"/>
    <button (click)="UnSelectItemByIndex()">UnSelectItemByIndex</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    showCheckBox: boolean;
        selectedIndices: array;
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    this.showCheckBox = true;
            this.selectedIndices=[1,2];
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    UnSelectItemByIndex(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
        obj.unselectItemByIndex("1,2");
    
    
    }
    }
  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" [showCheckbox]="showCheckBox" [selectedIndex]="selectedIndices" />
    <button (click)="UnSelectItemByIndex()">UnSelectItemByIndex</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    showCheckBox: boolean;
        selectedIndices: array;
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    this.showCheckBox = true;
            this.selectedIndices=[1,2];
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    UnSelectItemByIndex(){
    
    
    
    
    $("#countriesSelect").ejDropDownList("unselectItemByIndex",[1,2]);
        }
    }

    unselectItemByText(text)

    This method is used to unselect an item in the DropDownList by using the given text value.

    Name Type Description
    index string|number|array unselect the list items relates to given text

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" [showCheckbox]="showCheckBox" [selectedIndex]="selectedIndices"/>
    <button (click)="UnSelectItemByText()">UnSelectItemByText</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    showCheckBox: boolean;
        selectedIndices: array;
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    this.showCheckBox = true;
            this.selectedIndices=[1,2];
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    UnSelectItemByText(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
        obj.unselectItemByText("Armenia,Bangladesh");
    
    
    }
    }
  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" [showCheckbox]="showCheckBox" [selectedIndex]="selectedIndices" />
    <button (click)="UnSelectItemByText()">UnSelectItemByText</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    showCheckBox: boolean;
        selectedIndices: array;
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    this.showCheckBox = true;
            this.selectedIndices=[1,2];
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    UnSelectItemByText(){
    
    
    
    
    $("#countriesSelect").ejDropDownList("unselectItemByText","Armenia,Bangladesh");
        }
    }

    unselectItemByValue(value)

    This method is used to unselect an item in the DropDownList by using the given value.

    Name Type Description
    index string|number|array unselect the list items relates to given values

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" [showCheckbox]="showCheckBox" [selectedIndex]="selectedIndices"/>
    <button (click)="UnSelectItemByValue()">UnSelectItemByValue</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    showCheckBox: boolean;
        selectedIndices: array;
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    this.showCheckBox = true;
            this.selectedIndices=[1,2];
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    UnSelectItemByValue(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
        obj.unselectItemByValue("12,13");
    
    
    }
    }
  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" [showCheckbox]="showCheckBox" [selectedIndex]="selectedIndices" />
    <button (click)="UnSelectItemByValue()">UnSelectItemByValue</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    showCheckBox: boolean;
        selectedIndices: array;
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    this.showCheckBox = true;
            this.selectedIndices=[1,2];
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    UnSelectItemByValue(){
    
    
    
    
    $("#countriesSelect").ejDropDownList("unselectItemByValue","12,13");
        }
    }

    Events

    actionBegin

    Fires the action before the XHR request.

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    model object returns the DropDownList model
    type string returns the name of the event

    Example

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" (actionBegin)="actionBeginEvent($event)" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    itemsCount: int;
        query: any;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
        }
        actionBeginEvent(args){
    
    
    /*Do your changes */
    
    }
    }

    actionComplete

    Fires the action when the list of items is bound to the DropDownList by xhr post calling

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    count number Returns number of times trying to fetch the data
    model object returns the DropDownList model
    query object Returns the query for data retrieval
    request object Returns the query for data retrieval from the Database
    type string returns the name of the event
    result array Returns the number of items fetched from remote data
    xhr object Returns the requested data

    Example

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" (actionComplete)="actionCompleteEvent($event)" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    itemsCount: int;
        query: any;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
        }
        actionCompleteEvent(args){
    
    
    /*Do your changes */
    
    }
    }

    actionFailure

    Fires the action when the xhr post calling failed on remote data binding with the DropDownList control.

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    error object Returns the error message
    model object returns the DropDownList model
    query object Returns the query for data retrieval
    type string returns the name of the event

    Example

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" (actionFailure)="actionFailureEvent($event)" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    itemsCount: int;
        query: any;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
        }
        actionFailureEvent(args){
    
    
    /*Do your changes */
    
    }
    }

    actionSuccess

    Fires the action when the xhr post calling succeed on remote data binding with the DropDownList control

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    count number Returns number of times trying to fetch the data
    model object returns the DropDownList model
    query object Returns the query for data retrieval
    request object Returns the query for data retrieval from the Database
    type string returns the name of the event
    result array Returns the number of items fetched from remote data
    xhr object Returns the requested data

    Example

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" (actionSuccess)="actionSuccessEvent($event)" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    itemsCount: int;
        query: any;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
        }
        actionSuccessEvent(args){
    
    
    /*Do your changes */
    
    }
    }

    beforePopupHide

    Fires the action before the popup is ready to hide.

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    model object returns the DropDownList model
    type string returns the name of the event
    text string returns the selected text
    value string returns the selected value

    Example

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" (beforePopupHide)="BeforePopupHideEvent($event)" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    itemsCount: int;
        query: any;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
        }
        BeforePopupHideEvent(args){
    
    
    /*Do your changes */
    
    }
    }

    beforePopupShown

    Fires the action before the popup is ready to be displayed.

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    model object returns the DropDownList model
    type string returns the name of the event
    text string returns the selected text
    value string returns the selected value

    Example

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" (beforePopupShown)="BeforePopupShownEvent($event)" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    itemsCount: int;
        query: any;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
        }
        BeforePopupShownEvent(args){
    
    
    /*Do your changes */
    
    }
    }

    cascade

    Fires when the cascading happens between two DropDownList exactly after the value changes in the first dropdown and before filtering in the second Dropdown.

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    cascadeModel object Returns the cascading dropdown model.
    cascadeValue string returns the current selected value in first dropdown.
    model object returns the DropDownList model
    requiresDefaultFilter boolean returns the default filter action for second dropdown data should happen or not.
    type string returns the name of the event

    Example

  • HTML
  • <input id="countrySelect" ej-dropdownlist [dataSource]="countries" [fields]="fields" width="50%" [enabled]="enabled"/>
    <input id="groupSelect" ej-dropdownlist [dataSource]="groups" [fields]="group" width="50%" cascadeTo="countrySelect" (cascade)="cascade($event)"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './cascadeTo.component.html'
    })
    export class cascadeToComponent {
        countries: Array<Object> = [];
    
    groups: Array<Object> = [];
    
    group: Object;
        fields: Object;   
    
    enabled: boolean;
        constructor() {
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 18, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    this.groups = [
    
    
        { parentId: 'a', text: "Group A" },
                { parentId: 'b', text: "Group B" },
                { parentId: 'c', text: "Group C" },
                { parentId: 'd', text: "Group D" },
                { parentId: 'e', text: "Group E" }
    
    
    ];
            this.fields = { dataSource: this.countries, text: 'text', value: 'value' };
    
    
    this.group={ dataSource: this.groups, text: 'text', value: 'parentId'};
    
    
    this.enabled= false;
        }
        cascade(args){
            /*Do your changes */
        }
    }

    change

    Fires the action when the DropDownList control’s value is changed.

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    isChecked boolean Returns the selected item with checkbox checked or not.
    itemId string Returns the selected item ID.
    model object returns the DropDownList model
    selectedText string Returns the selected item text.
    type string returns the name of the event
    text string Returns the selected text.
    value string Returns the selected value.

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0  (ejchange)="Change($event)"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    Change(args){
    
    
    
    
    /*Do your changes */
        }
    }

    checkChange

    Fires the action when the list item checkbox value is changed.

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    isChecked boolean Returns the selected item with checkbox checked or not.
    itemId string Returns the selected item ID.
    model object returns the DropDownList model
    selectedText string Returns the selected item text.
    type string returns the name of the event
    text string Returns the selected text.
    value string Returns the selected value.

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 [showCheckbox]="showCheckBox" (checkChange)="CheckChange($event)"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
        showCheckBox: boolean;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
            this.showCheckBox = true;
    
    
        }
    
    CheckChange(args){
    
    
    
    
    /*Do your changes */
        }
    }

    create

    Fires the action once the DropDownList is created.

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    model object returns the DropDownList model
    type string returns the name of the event

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 [showCheckbox]="showCheckBox" (create)="Create($event)"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
        showCheckBox: boolean;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
            this.showCheckBox = true;
    
    
        }
    
    Create(args){
    
    
    
    
    /*Do your changes */
        }
    }

    dataBound

    Fires the action when the list items is bound to the DropDownList.

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    model object returns the DropDownList model
    type string returns the name of the event
    data object returns the data that is bound to DropDownList

    Example

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" (dataBound)="DataBoundEvent($event)" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    itemsCount: int;
        query: any;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
        }
        DataBoundEvent(args){
    
    
    /*Do your changes */
    
    }
    }

    destroy

    Fires the action when the DropDownList is destroyed.

    Name Type Description
    cancel boolean its value is set as true,if the event should be canceled; otherwise, false.
    model object returns the DropDownList model
    type string returns the name of the event

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 (destroy)="DestroyEvent($event)" />
    <button (click)="Destroy()">Destroy</button>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
    
    
        }
    
    Destroy(){
    
    
    
    
    var obj=$("#countriesSelect").data("ejDropDownList");
    
    
    obj.destroy());
    
    
    
    }
        DestroyEvent(args){
         /*Do your changes */
        }
    }

    focusIn

    Fires the action when the DropDownList is focused.

    Name Type Description
    cancel boolean its value is set as true,if the event should be canceled; otherwise, false.
    model object returns the DropDownList model
    type string returns the name of the event

    Example

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" (focusIn)="FocusInEvent($event)" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    itemsCount: int;
        query: any;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
        }
       FocusInEvent(args){
    
    
    /*Do your changes */
    
    }
    }

    focusOut

    Fires the action when the DropDownList is about to lose focus.

    Name Type Description
    cancel boolean its value is set as true,if the event should be canceled; otherwise, false.
    model object returns the DropDownList model
    type string returns the name of the event

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 [showCheckbox]="showCheckBox" (focusOut)="FocusOut($event)"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
        showCheckBox: boolean;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
            this.showCheckBox = true;
    
    
        }
    
    FocusOut(args){
    
    
    
    
    /*Do your changes */
        }
    }

    popupHide

    Fires the action, once the popup is closed

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    model object returns the DropDownList model
    type string returns the name of the event
    text string returns the selected text
    value string returns the selected value

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 [showCheckbox]="showCheckBox" (popupHide)="popupHide($event)"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
        showCheckBox: boolean;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
            this.showCheckBox = true;
    
    
        }
    
    popupHide(args){
    
    
    
    
    /*Do your changes */
        }
    }

    popupResize

    Fires the action, when the popup is resized.

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    model object returns the DropDownList model
    type string returns the name of the event
    event object Returns the data from the resizable plugin.

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 [showCheckbox]="showCheckBox" enablePopupResize=true (popupResize)="PopupResizeEvent($event)" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
        showCheckBox: boolean;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
            this.showCheckBox = true;
    
    
        }
    
    PopupResizeEvent(args){
    
    
    
    
    /*Do your changes */
        }
    }

    popupShown

    Fires the action, once the popup is opened.

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    model object returns the DropDownList model
    type string returns the name of the event
    text string returns the selected text
    value string returns the selected value

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 [showCheckbox]="showCheckBox" enablePopupResize=true (popupShown)="PopupShownEvent($event)" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
        showCheckBox: boolean;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
            this.showCheckBox = true;
    
    
        }
    
    PopupShownEvent(args){
    
    
    
    
    /*Do your changes */
        }
    }

    popupResizeStart

    Fires the action, when resizing a popup starts.

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    model object returns the DropDownList model
    type string returns the name of the event
    event object Returns the data from the resizable plugin.

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 [showCheckbox]="showCheckBox" enablePopupResize=true (popupResizeStart)="PopupResizeStart($event)" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
        showCheckBox: boolean;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
            this.showCheckBox = true;
    
    
        }
    
    PopupResizeStart(args){
    
    
    
    
    /*Do your changes */
        }
    }

    popupResizeStop

    Fires the action, when the popup resizing is stopped.

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    model object returns the DropDownList model
    type string returns the name of the event
    event object Returns the data from the resizable plugin.

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" selectedIndex=0 [showCheckbox]="showCheckBox" enablePopupResize=true (popupResizeStop)="PopupResizeStop($event)" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
        showCheckBox: boolean;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
            this.showCheckBox = true;
    
    
        }
    
    PopupResizeStop(args){
    
    
    
    
    /*Do your changes */
        }
    }

    search

    Fires the action before filtering the list items that starts in the DropDownList when the enableFilterSearch is enabled.

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    items object Returns the data bound to the DropDownList.
    model object returns the DropDownList model
    selectedText string Returns the selected item text.
    type string returns the name of the event
    searchString string Returns the search string typed in search box.

    Example

  • HTML
  • <input id="CompanySelect" ej-dropdownlist [dataSource]="data" [fields]="fields" width=340 [(value)]="value" [query]="query" [enableFilterSearch]="enableFilterSearch" [itemsCount]="itemsCount" (search)="SearchEvent($event)" />
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './Dropdownlist.component.html'
    })
    export class DropdownlistComponent {
        fields: Object;
    
    data: Object;
    
    enableFilterSearch: boolean;
    
    itemsCount: int;
        query: any;
    
        constructor() {       
            this.fields = {  text: "ShipName", groupBy: "ShipCountry"};
            this.data = ej.DataManager({ url: "http://mvc.syncfusion.com/services/Northwnd.svc/Orders" });
    
    
    this.itemsCount= 20;
    
    
    this.enableFilterSearch= true;
            this.query = ej.Query().select("ShipName", "ShipCountry");
        }
        SearchEvent(args){
    
    
    /*Do your changes */
    
    }
    }

    select

    Fires the action, when the list of item is selected.

    Name Type Description
    cancel boolean if the event should be canceled; otherwise, false.
    isChecked boolean Returns the selected item with checkbox checked or not.
    itemId string Returns the selected item ID.
    model object returns the DropDownList model
    selectedText string Returns the selected item text.
    type string returns the name of the event
    text string Returns the selected text.
    value string Returns the selected value.

    Example

  • HTML
  • <input id="countriesSelect" ej-dropdownlist [dataSource]="countries" [fields]="fields"  width=340 [(value)]="value" multiSelectMode="VisualMode" [showCheckbox]="showCheckBox" (select)="Select($event)"/>
  • TS
  • import {Component} from '@angular/core';
    
    @Component({
        selector: 'ej-app',
        templateUrl: './DropDownList.component.html'
    })
    export class DropDownListComponent {
        countries: Array<Object> = [];
    
        fields: Object;
        showCheckBox: boolean;
    
    
        constructor() {
    
    
    
            this.countries = [
               { value: 11, parentId: 'a', text: "Algeria"},
               { value: 12, parentId: 'a', text: "Armenia"},
               { value: 13, parentId: 'a', text: "Bangladesh"},
               { value: 14, parentId: 'a', text: "Cuba"},
               { value: 15, parentId: 'b', text: "Denmark"},
               { value: 16, parentId: 'b', text: "Egypt"},
               { value: 17, parentId: 'c', text: "Finland"},
               { value: 10, parentId: 'c', text: "India"},
               { value: 19, parentId: 'c', text: "Malaysia"},
               { value: 20, parentId: 'd', text: "New Zealand"},
               { value: 21, parentId: 'd', text: "Norway"},
               { value: 22, parentId: 'd', text: "Poland"},
               { value: 23, parentId: 'e', text: "Romania"},
               { value: 24, parentId: 'e', text: "Singapore"},
               { value: 25, parentId: 'e', text: "Thailand"},
               { value: 26, parentId: 'e', text: "Ukraine"}
            ];
    
    
    
            this.fields = {  text: "text", value: "value" };
            this.showCheckBox = true;
    
    
        }
    
    Select(args){
    
    
    
    
    /*Do your changes */
        }
    }