Hi
I need create a multiselect dropdown with checkbox in grid filter.
I start with this code, but the dropdownList dont show the checkbox.
Any help is appreciated
Best regards
Diego
import { MultiSelect, CheckBoxSelection } from '@syncfusion/ej2-angular-dropdowns';
MultiSelect.Inject(CheckBoxSelection);
@Component({
selector: 'app-root',
templateUrl: 'app.component.html'
})
export class AppComponent {
public data: Object[] = [];
public statusDataSource: Object[] = [
{
text: 'aaaaaa',
value: '1',
},
. . .
},
];
public filterOptions: FilterSettingsModel;
public filter: IFilter;
public dropInstance: MultiSelect;
ngOnInit(): void {
this.data = orderDetails;
this.filterOptions = {
type: 'Menu'
};
this.filter = {
ui: {
create: (args: { target: Element; column: object }) => {
const flValInput: HTMLElement = createElement('input', { className: 'flm-input' });
args.target.appendChild(flValInput);
this.dropInstance = new MultiSelect({
dataSource: new DataManager(this.statusDataSource),
fields: { text: 'text', value: 'value' },
placeholder: 'Select a value',
popupHeight: '200px',
mode: 'CheckBox',
});
this.dropInstance.appendTo(flValInput);
},
. . .
},
};
}
} |
Hi Manivel
Thanks for help. I'ts works perfectly
I need more help for retrieve the array of selected's checkboxes values for pass to the filter query.
How do I have to do it?
Best regards
Diego
export class AppComponent {
public data: Object[] = [];
. . .
];
public filterOptions: FilterSettingsModel;
public filter: IFilter;
public dropInstance: MultiSelect;
ngOnInit(): void {
this.data = orderDetails;
this.filterOptions = {
type: 'Menu'
};
this.filter = {
ui: {
create: (args: { target: Element; column: object }) => {
const flValInput: HTMLElement = createElement('input', { className: 'flm-input' });
args.target.appendChild(flValInput);
this.dropInstance = new MultiSelect({
dataSource: new DataManager(this.statusDataSource),
fields: { text: 'text', value: 'value' },
placeholder: 'Select a value',
popupHeight: '200px',
mode: 'CheckBox',
});
this.dropInstance.appendTo(flValInput);
},
write: (args: { column: object; target: Element; parent: any; filteredValue: number | string }) => {
this.dropInstance.text = (args.filteredValue as string) || '';
},
// this method will trigger while clicking the filter button of the filter menu Dialog
read: (args: { target: Element; column: any; operator: string; fltrObj: Filter }) => {
// here we have passed the selected values
args.fltrObj.filterByColumn(args.column.field, args.operator, this.dropInstance.text);
},
},
};
}
} |