This is a migrated thread and some comments may be shown as answers.

No Check/Uncheck all event

7 Answers 71 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 07 Nov 2012, 12:10 PM
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

7 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 08 Nov 2012, 05:41 AM
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.
0
Jon
Top achievements
Rank 1
answered on 08 Nov 2012, 10:01 AM
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
0
Accepted
Princy
Top achievements
Rank 1
answered on 09 Nov 2012, 03:56 AM
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.
0
Jon
Top achievements
Rank 1
answered on 09 Nov 2012, 08:26 AM
Hi Princy,

You are as always a star!

Many thanks for your help.

Best Regards,

Jon
0
Akun
Top achievements
Rank 1
answered on 29 Mar 2019, 12:55 PM
<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>
0
Akun
Top achievements
Rank 1
answered on 29 Mar 2019, 12:56 PM

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>

0
Akun
Top achievements
Rank 1
answered on 31 Mar 2019, 11:28 AM
<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
Tags
ComboBox
Asked by
Jon
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Jon
Top achievements
Rank 1
Akun
Top achievements
Rank 1
Share this question
or