Completed
Last Updated: 27 Dec 2019 13:37 by ADMIN
JEAN CHARLES
Created on: 21 Jun 2019 14:55
Category: Grid
Type: Bug Report
1
Column selectable, css selector collision onclick

When clicking on CheckBox to select a line, the widget check other checkbox (on other column of the same line) inserted from column template.

I suppose that the selector that the system use is too large.

 

For information, i created a template for boolean column based on how kendo generate checkbox structure (just de be coherent)

 

See the code extracted from https://dojo.telerik.com/EqiPIkiV

 

 var checkBoxtemplate = function(boolValue){
   	var checkedStr = '';
    if (boolValue) {
    	checkedStr = 'checked="checked"';
    }

        
    return '<input class="k-checkbox" data-role="checkbox" ' + checkedStr + ' type="checkbox"><label class="k-checkbox-label k-no-text smi-checkbox-fordisplay"></label>';
 };
  
$("#grid").kendoGrid({
  columns: [
    {
      selectable: true, 
      width: '30px'
    },
    { field: "name" },
    { field: "age" },
    { field: "administator", 
      template: function (dataItem) { 
        return checkBoxtemplate(dataItem.administator); 
      }  
    }
  ],
  dataSource: [
    { name: "Jane Doe", age: 30, administator: false },
    { name: "John Doe", age: 33, administator: false },
    { name: "BigBoss Doe", age: 70, administator: true }
  ],
  selectable: true
});

Attached Files:
3 comments
JEAN CHARLES
Posted on: 03 Jul 2019 09:28

I cannot mark the bug as resolved, so can you do it for me ?

Best regards

JEAN CHARLES
Posted on: 03 Jul 2019 09:26

Thanks for the answer, i will apply this fix to my solution and mark the bug as "resolved".

 

For general abstraction, would it be better to have the "internal grid logic" to apply selection only on the element (checkbox) clicked?

That would allow the use of "data-role=checkbox" (more generically "data-whatever") without having to worry about the collision.

ADMIN
Viktor Tachev
Posted on: 28 Jun 2019 08:25
Hello,

The reason for this behavior is that data-role attribute is applied to the template. Because of this the internal Grid logic handling checkbox selection selects both the checkbox in the Selectable column and the one in the template. 

If you would like to have a checkbox in the Grid that is bound to a field it is recommended to remove the data-role attribute from the template. Check out the updated dojo below for reference.




Regards,
Viktor Tachev
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.