Minimum selected items

2 posts, 0 answers
  1. Scott
    Scott avatar
    14 posts
    Member since:
    Mar 2013

    Posted 19 Mar 2015 Link to this post

    I'm wondering if it's possible to enforce a minimum number of selections in a multiselect widget. I'd like to prevent the user from removing all items from the list, requiring at least one for validity. I see that there's a maxSelectedItems option, but there doesn't appear to be a minSelectedItems. I played with the select and change event hooks, but select doesn't seem to fire on removal and change fires after the item has been removed from the list.

    Is there another way I could go about this?
  2. Kiril Nikolov
    Kiril Nikolov avatar
    2596 posts

    Posted 21 Mar 2015 Link to this post

    Hello Scott,

    You can use the change event of the widget, and if you detect that the last item is getting removed, you can just add the default item that you want to see there. Here is an example that you can use as a base reference:

    Kiril Nikolov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top