Hi,
We've just upgraded our Grid from 5.6.2 to 5.6.6. Upon upgrade, we've noticed that our custom CheckColumn throws an error when trying to access the widget:
Cannot read properties of undefined (reading '0')
This can be replicated using the following code:
import { Toast, Grid, DataGenerator, CheckColumn, ColumnStore, StringHelper } from '../../build/grid.module.js?474079';
import shared from '../_shared/shared.module.js?474079';
class CustomCheckColumn extends CheckColumn {
static type = 'customCheck';
static get defaults() {
return {
maxWidth: 50,
resizable: false
};
}
renderer({ widgets }) {
widgets[0].disabled = true;
}
}
ColumnStore.registerColumnType(CustomCheckColumn);
new Grid({
appendTo : 'container',
columns : [
{ type : 'rownumber' },
{
text : 'Template',
minWidth : 160,
flex : 1,
field : 'name',
type : 'template',
template : data => StringHelper.xss`Hi ${data.record.name}!`,
// Cheaper measuring when sizing to fit content
fitMode : 'value',
editor : {
label : 'Name'
}
},
{
text : 'Custom rendering',
width : 150,
type : 'customCheck'
},
{ text : 'Date', field : 'start', width : 130, type : 'date', format : 'MMMM D YYYY' },
],
data : DataGenerator.generateData({
count : 50,
addSkills : 3
})
});
Adding a guard to the renderer suppresses the error, but results in the checkbox disappearing entirely:
renderer({ widgets }) {
if (!widgets?.length) {
return;
}
widgets[0].disabled = true;
}
This functionality used to work on version 5.6.2. Please could you fix this regression ASAP or advise if we are doing something wrong!
Thanks.