Disable key input when maxSelectedItems condition is met

4 posts, 0 answers
  1. El Nacho
    El Nacho avatar
    16 posts
    Member since:
    May 2014

    Posted 28 Jan 2016 Link to this post

    Hi, this control is amazing but i have two questions.

    How can i disable the keyboard input, without disabling the whole control when the maxSelectedItems condition is met?. I've tried disabling the control but then the user can't delete the already selected item, and out of the box it allows the user to input meaningless data that confuses them if it's going to be submited or not.

    Also i would like to have a way to re enable the keyboard input if they delete an item and the count is lower than the maxSelectedItems.

    Here is the dojo with the default behavior: http://dojo.telerik.com/@mfito/EPUTI

    I'm using the angular implementation but i don't mind an answer in jQuery. Thanks in advance, keep doing a great job!.

  2. Patrick
    Patrick avatar
    257 posts

    Posted 29 Jan 2016 Link to this post

    Hi Joseph,

    Take a look at the following Telerik Dojo illustrating a solution for both of your scenarios.

    Here is the code I used in the change event:
    change: function(e) {
              var amountOfSelectedItems = this.dataItems().length;
           var maxSelectedItems = e.sender.options.maxSelectedItems;
              if (amountOfSelectedItems >= maxSelectedItems){
                $('.k-input').attr('readonly', "readonly");
              } else {

    Here is another Dojo using the same approach with AngularJS.

    Hopefully this helps steer you in the right direction.

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Marouan
    Marouan avatar
    6 posts
    Member since:
    Apr 2017

    Posted 03 May 2017 in reply to Patrick Link to this post

    Hi patrick

    How Can I solve it if I use angular controls.


  4. Dimitar
    Dimitar avatar
    814 posts

    Posted 05 May 2017 Link to this post

    Hello Marouan,

    On the following Dojo examle you will find a modified version of the previous example, which works with AngularJS. You will notice that I have set the change event handler through k-on-change attribute, which executes the previously shown javascript code to make the input field readonly.

    For additional information about angular integration you can have a look at this documentation article. You can also find an AngularJS demo for every widget in Kendo UI demos website. You can find the one for the MulstiSelect widget here.

    I hope this helps.

    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top