No Check/Uncheck all event

8 posts, 1 answers
  1. Jon
    Jon avatar
    813 posts
    Member since:
    Oct 2008

    Posted 07 Nov 2012 Link to this post

    Hi,

    Why isn't there a check/uncheck all event for the combo box?

    If I need to have a second related form element I can't do it from this as there is no JS event for when items are checked.  Yes you can get individual checks but there is no event raised when all are done. 

    From looking at the forums this is appears to have been going on for a while.  Please advise on a way to get notified on the client when the check all box is checked.  

    Thanks,

    Jon
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 07 Nov 2012 Link to this post

    Hi Jon,

    Try the following code to achieve your scenario.

    JS:
    <script type="text/javascript">
     function OnClientItemChecked(sender, args)
     {
      var check = true;
      var uncheck = true;
      var c =sender.get_items().get_count();
      for (var i = 0; i < sender.get_items().get_count(); i++)
      {
       if (!sender.get_items()._array[i].get_checked())
       {
        check = false;
       }
       if (sender.get_items()._array[i].get_checked())
       {
        uncheck = false;
       }
      }
      if (check)
      {
       alert("checked");
       // Your Code
      }
      if (uncheck)
      {
       alert("unchecked");
       // Your Code
      }
     }
    </script>

    Hope this helps.

    Thanks,
    Princy.
  3. Jon
    Jon avatar
    813 posts
    Member since:
    Oct 2008

    Posted 08 Nov 2012 Link to this post

    Hi Princy,

    Thanks for that.  It doesn't work though - that only gets fired when one of the normal checkboxes is ticked.  If the Check All checkbox is ticked there appears to be no event for that! - and as per my other post none of them at all fire on the latest version for a parented drop down :( 

    It seems really strange to not have an event for the check all - or to fire a check event when the children are checked...

    Regards

    Jon
  4. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 08 Nov 2012 Link to this post

    Hi Jon,

    Try the following code to fire an event on changes in CheckAll checkbox of RadComboBox.

    JS:
    <script type="text/javascript">
     function pageLoad()
     {
      var combos = Telerik.Web.UI.RadComboBox.ComboBoxes;
      if (combos != null)
      {
       for (var i = 0; i < combos.length; i++)
       {
         var combo = combos[i];
         var element = combo.get_dropDownElement();
         var checkAll = $telerik.$(element).find(".rcbCheckAllItemsCheckBox");
         checkAll.change(function () {
                        alert(combo._uniqueId);
                    });
       }
      }
     }
    </script>

    Hope this helps.

    Thanks,
    Princy.
  5. Jon
    Jon avatar
    813 posts
    Member since:
    Oct 2008

    Posted 09 Nov 2012 Link to this post

    Hi Princy,

    You are as always a star!

    Many thanks for your help.

    Best Regards,

    Jon
  6. Akun
    Akun avatar
    3 posts
    Member since:
    Mar 2019

    Posted 29 Mar in reply to Princy Link to this post

    <script type="text/javascript">
     function OnClientItemChecked(sender, args)
     {
      var check = true;
      var uncheck = true;
      var c =sender.get_items().get_count();
      for (var i = 0; i < sender.get_items().get_count(); i++)
      {
       if (!sender.get_items()._array[i].get_checked())
       {
        check = false;
       }
       if (sender.get_items()._array[i].get_checked())
       {
        uncheck = false;
       }
      }
      if (check)
      {
       alert("checked");
       // Your Code
      }
      if (uncheck)
      {
       alert("unchecked");
       // Your Code
      }
     }
    </script>
  7. Akun
    Akun avatar
    3 posts
    Member since:
    Mar 2019

    Posted 29 Mar Link to this post

    free fire unchek

    <script type="text/javascript">
     function OnClientItemChecked(sender, args)
     {
      var check = true;
      var uncheck = true;
      var c =sender.get_items().get_count();
      for (var i = 0; i < sender.get_items().get_count(); i++)
      {
       if (!sender.get_items()._array[i].get_checked())
       {
        check = false;
       }
       if (sender.get_items()._array[i].get_checked())
       {
        uncheck = false;
       }
      }
      if (check)
      {
       alert("checked");
       // Your Code
      }
      if (uncheck)
      {
       alert("unchecked");
       // Your Code
      }
     }
    </script>

  8. Akun
    Akun avatar
    3 posts
    Member since:
    Mar 2019

    Posted 31 Mar in reply to Princy Link to this post

    <script type="text/javascript">
     functionOnClientItemChecked(sender, args)
     {
      var check = true;
      var uncheck = true;
      var c =sender.get_items().get_count();
      for (var i = 0; i < sender.get_items().get_count(); i++)
      {
       if(!sender.get_items()._array[i].get_checked())
       {
        check = false;
       }
       if(sender.get_items()._array[i].get_checked())
       {
        uncheck = false;
       }
      }
      if (check)
      {
       alert("checked");
       // Your Code
      }
      if (uncheck)
      {
       alert("unchecked");
       // Your Code
      }
     }
    </script> unchek Free Fire REGISTER Indonesia
Back to Top