Allow only single checkbox to be checked at a time

6 posts, 0 answers
  1. jeff
    jeff avatar
    73 posts
    Member since:
    Sep 2014

    Posted 06 Nov 2014 Link to this post

    Simple in jQuery, but I haven't figured out to only allow one checkbox checked at a time (used to enable editing a specific user): I'm using the following simple jquery to enable/disable buttons:

                                        function onCheck(e) {
                                            
    if ($('input.checkTreeview').is(':checked')) {
                                                  $(
    '#addUserButton').attr('disabled', 'disabled');
                                                  $(
    '#modifyUserButton').attr('disabled', false);
                                             }
    else {
                                                  $(
    '#addUserButton').attr('disabled', false);
                                                  $(
    '#modifyUserButton').attr('disabled', 'disabled');
                                              }

                                        }


    Anything I can do here to allow only one checkbox checked at a time?
  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2512 posts

    Posted 07 Nov 2014 Link to this post

    Hello Jeff,

    See this Dojo snippet for a way to show only one checked checkbox.

    Regards,
    Alex Gyoshev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. jeff
    jeff avatar
    73 posts
    Member since:
    Sep 2014

    Posted 07 Nov 2014 in reply to Alex Gyoshev Link to this post

    Hi Alex,
    Thank you for the response, but when I go to the dojo, I'm getting "failed to load snippet", etc.. Please feel free to paste here for the interim, thank you!
  4. jeff
    jeff avatar
    73 posts
    Member since:
    Sep 2014

    Posted 07 Nov 2014 Link to this post

    Nevermind.. Local network "issues". Anyways, worked lovely, exactly what I was after, thank you!
  5. JMB
    JMB avatar
    5 posts
    Member since:
    Apr 2008

    Posted 13 Dec 2016 Link to this post

    Hi,

    Are you sure this solution still works ? I'm able to lock one single leaf selection at a time, but nodes refuses to be checked because the algorithm uncheck all others checkboxes, so automatically the node gets unchecked.

  6. Stefan
    Admin
    Stefan avatar
    728 posts

    Posted 15 Dec 2016 Link to this post

    Hello  Jean-Marc,

    I took the example provided by my colleague Alex and updated it to the latest version of Kendo UI(2016.3.1118) and it is working as expected:

    http://dojo.telerik.com/oqADu

    Let me know if additional assistance is needed on this matter.

    Regards,
    Stefan
    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