Allow only single checkbox to be checked at a time

8 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
    2527 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
    2056 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.
  7. Jonathan Berry
    Jonathan Berry avatar
    2 posts
    Member since:
    Mar 2018

    Posted 03 Oct in reply to Stefan Link to this post

    I think this should be added as a configuration option under checkboxes.  Maybe something called "singleSelect", that is a boolean. 
  8. Neli
    Admin
    Neli avatar
    221 posts

    Posted 05 Oct Link to this post

    Hi Jonathan,

    I would suggest you to submit the issue in the Kendo UI Feedback Portal. Depending on the popularity it gain from the comunity, it could be considered for future implementation.

    Regards,
    Neli
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top