|
import { MultiSelectAllModule } from '@syncfusion/ej2-angular-dropdowns'; |
|
import { Component, OnInit } from '@angular/core';
import { CheckBoxSelectionService, FilteringEventArgs } from '@syncfusion/ej2-angular-dropdowns';
@Component({
selector: 'app-root',
// specifies the template string for the MultiSelect component
template: `<ejs-multiselect id='multiselectelement' [dataSource]='sportsData' [fields]='fields'(filtering)='onFiltering($event)' [mode]='mode' [placeholder]='placeholder'></ejs-multiselect>`,
providers: [CheckBoxSelectionService]
})
export class AppComponent {
public mode: string;
constructor() {
}
} |
|
[app.component.html]
<ejs-multiselect id='multiselect-checkbox' #checkbox [dataSource]='countries' [placeholder]='checkWaterMark' [fields]='checkFields'
[mode]='mode' [popupHeight]='popHeight' width="150px" [showDropDownIcon]='true' allowFiltering="true" showSelectAll='true' [filterBarPlaceholder]='filterPlaceholder' [value]="value"></ejs-multiselect> |
|
[app.component.ts]
export class AppComponent {
@ViewChild('checkbox')
public mulObj: MultiSelectComponent;
public mode: string;
public filterPlaceholder: string;
//define the data with category
public countries: { [key: string]: Object }[] = [
{ Name: 'Australia', Code: 'AU' },
{ Name: 'Bermuda', Code: 'BM' },
{ Name: 'Canada', Code: 'CA' },
{ Name: 'Cameroon', Code: 'CM' },
{ Name: 'Denmark', Code: 'DK' },
{ Name: 'France', Code: 'FR' },
{ Name: 'Finland', Code: 'FI' },
{ Name: 'Germany', Code: 'DE' },
{ Name: 'Greenland', Code: 'GL' },
{ Name: 'Hong Kong', Code: 'HK' },
{ Name: 'India', Code: 'IN' },
{ Name: 'Italy', Code: 'IT' },
{ Name: 'Japan', Code: 'JP' },
{ Name: 'Mexico', Code: 'MX' },
{ Name: 'Norway', Code: 'NO' },
{ Name: 'Poland', Code: 'PL' },
{ Name: 'Switzerland', Code: 'CH' },
{ Name: 'United Kingdom', Code: 'GB' },
{ Name: 'United States', Code: 'US' }
];
// map the groupBy field with category column
public checkFields: Object = { text: 'Name', value: 'Code' };
// set the placeholder to the MultiSelect input
public checkWaterMark: string = 'Select countries';
public value = ["AU","BM"];
// set the MultiSelect popup height
public popHeight: string = '350px';
ngOnInit(): void {
this.mode = 'CheckBox';
this.filterPlaceholder = 'Search countries';
}
} |
Hey Hi , I need even one data came time i need select all option i need how to achieve that user want like .
Hi
Please follow the below forum for further updates regarding your query,
Regards,
Shereen