How to restrict multiselection conditionally

Posted by: sdayal on 28 April 2024, 6:28 pm EST

    • Post Options:
    • Link

    Posted 28 April 2024, 6:28 pm EST

    Hi Wijmo team,

    https://stackblitz.com/edit/angular-pm5nse?file=src%2Fapp%2Fapp.component.ts

    Need one help in above snippet, I need to put some extra conditions if I try to select ‘test’ from Section column then in corresponding **Subjects column **‘All’ keyword should be disabled and I should be only allowed to select one element from Subject dropdown(multiselection should be avoided if I select ‘test’ value from Section dropdown), same should also happen for sub-subjects column too…

    Thanks

  • Posted 29 April 2024, 9:59 pm EST

    Hi,

    You’ll need to set the ‘showSelectAllCheckbox’ property by checking the value of the ‘item.section’ in the row’s dataItem to hide/show the ‘All’ checkbox in the MultiSelect dropdown. You’ll also need to modify the ‘checkedItemsChanged’ event handler function to keep only one item selected/checked when ‘test’ is selected in ‘section’ column.

    Please refer to the following updated sample for the same - https://stackblitz.com/edit/angular-ctzz3w?file=src%2Fapp%2Fapp.component.ts

    Refer to lines 567, 569-573 in the ‘app.component.ts’ file for changes, similar changes have been made in the multiSelect used in ‘sub-subjects’ column.

    Regards

  • Posted 5 May 2024, 4:00 pm EST - Updated 5 May 2024, 4:52 pm EST

    Thanks for solution

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels