Skip to content Skip to sidebar Skip to footer

Checkbox Event Is Not Firing With Jquery

I have got checkbox row in parent grid and checkbox row in child grid as well in Hierarchy grid mode using kendo UI. the architecture is like this... I have got four rows in parent

Solution 1:

Try this,

 $('#Gridparent').on("click", ".chkbxq", function (e) {

       var selected = $(this).is(':checked');

        var grid = $("#grid12").data("kendoGrid");


        if (selected == true) {

            var check = $('.k-detail-row').find('td.k-detail-cell').find('div.k-grid').find('table').find('tbody').find('[type="checkbox"]').attr('checked', true);
            var asd = check.is(':checked');
            alert(asd);
        }

        });

Use grid click.

Solution 2:

This is how I imagine it should be coded - disclaimer I do not know Kendo at all

If we need to process the checkboxes as you WRITE, we can do

$(function() {
  $('.chkbxq').on('click', function (e) {
    var checked = this.checked;
    $('#Gridparent').find(".k-detail-row").find('td.k-detail-cell').find('[type="checkbox‌​"]').each(function()
      this.checked=checked; // toggle
    });    
  });    
});        

If the content is ajaxed in, you need

$(function() {
  $("#Gridparent").on('click','.chkbxq', function (e) {
    var checked = this.checked;
    $(this).find(".k-detail-row").find('td.k-detail-cell').find('[type="checkbox‌​"]').each(function()
      this.checked=checked; // toggle
    });    
  });    
});        

NOTE .find works all the way down the dom, so perhaps you just want

$(this).find('[type="checkbox‌​"]').each(function()

Solution 3:

see following if it helps:

<scripttype="text/javascript">

   $('.chkbxq').on('click', function (e) {

    alert('1'); // this alert is not firing var checkchildgrid = $('#Gridparent').find(".k-detail-row").find('td.k-detail-cell').find('[type="checkbox‌​"]').prop('checked');
    alert(checkchildgrid);

    if ($(this).prop('checked')) {    
        checkchildgrid.prop('checked', 'checked');
    } else {
        checkchildgrid.prop('checked', false);
    }    
});        

i hope it helps.

Post a Comment for "Checkbox Event Is Not Firing With Jquery"