Hi, I have spent some time trying to figure this out (also searched the forums). I have a need to have a column behaving as radiobuttons in a listgrid. Note that this is a client only grid, with the rows supplied in the data property.
I know the recommended approach is to use the selectionAppearance as 'checkbox', but this forces the button that behaves as a radio in the leftmost column of the grid. I needed it in a normal column, showing more to the right.
In the end, I was able to achieve the behavior using the code below for that field:
Seeking confirmation that this is indeed a correct way of addressing the problem and there's no other, built in, or more elegant way. It wouldn't be the first time I spent time trying to achieve something that was already built in.
Thanks,
Sorin
I know the recommended approach is to use the selectionAppearance as 'checkbox', but this forces the button that behaves as a radio in the leftmost column of the grid. I needed it in a normal column, showing more to the right.
In the end, I was able to achieve the behavior using the code below for that field:
Code:
{
name: 'Autoincrement',
title: 'Autoincrement',
type: 'boolean',
editorEnter: function (record, value, rowNum, colNum, grid) {
if ((grid.getFieldName(colNum) == 'Autoincrement') && value)
{
grid.cancelEditing();
for (i = 0; i < grid.data.getLength(); i++)
if ((i != rowNum) && (typeof grid.data[i].Autoincrement != 'undefined'))
{
grid.data[i].Autoincrement = undefined;
grid.refreshCell(i, colNum);
}
grid.data[rowNum].Autoincrement = true;
}
}
},
Thanks,
Sorin
Comment