I am using ng-multiselect-dropdown in my Angular 8.3 web SPA. I have a dropdown which has the functionality to select multiple options like so:
I need help with selecting the options in a continuous range. For example, as in the image, Q2
and Q4
are selected. I want to implement a functionality such that if a user selects Q2
and Q4
, Q3
gets auto-selected. Similarly, if a user first selects Q3
and then selects Q1
, Q2
gets auto-selected. In summary, upon selection of more than 1 quarters in a continuous range will need to be selected. However, if only one quarter (say Q4
) is selected, the others need not be selected.
component.html
<!-- Select quarter -->
<div class="dropdown ml-2"
>
<ng-multiselect-dropdown
[placeholder]="'Select quarter(s)'"
[settings]="dropdownSettings"
[data]="quarterList"
[(ngModel)]="selectedQuarterList"
(onDropDownClose)="onDropdownClose()"
(click)="this.isDropdownOpen = true"
>
</ng-multiselect-dropdown>
</div>
component.ts
ngOnInit() {
this.dropdownSettings = {
singleSelection: false,
idField: "quarterId",
textField: "title",
selectAllText: "Select All",
unSelectAllText: "Clear selection",
itemsShowLimit: 4,
allowSearchFilter: false,
};
}
Any help with the same is appreciated, thanks.