According to the documentation, the readOnly property can be defined at the grid level, column level, and model level. If the readOnly property is not defined for a column and no editor is defined for that column, then the readOnly property will not be set. However, we have observed inconsistencies in the behavior of the readOnly property in our grid.
Support Forum
Hey jitendra.singh,
Could you provide more details about the inconsistencies that you're referring to? Perhaps an example or something that you can reproduce in one of our demos??
You can see the guidelines here - https://www.bryntum.com/forum/viewtopic.php?f=1&t=772
Best regards,
Márcio
Hi Marcio,
Let's say we have a grid with some columns configured as follows:
columns: [{
text: 'First Name',
type: 'column',
field: 'firstName',
},
{
text: 'Last Name',
type: 'column',
field: 'surName'
},
]
Here are a few scenarios:
If we do not define the readOnly property of the grid, then all columns are editable as they should be.
If we define the readOnly property of the grid as true, then all columns are not editable as they should be.
If we do not define the readOnly property of the grid, but we define the readOnly property in the column as true, like shown below:
columns: [{
text: 'First Name',
type: 'column',
field: 'firstName',
readOnly: true,
},
{
text: 'Last Name',
type: 'column',
field: 'surName',
readOnly: true,
},
]
By using this configuration, we observed that the columns are still editable. To make the column non-editable, we have to explicitly define the editor property as false, as shown below:
columns: [{
text: 'First Name',
type: 'column',
field: 'firstName',
editor: false,
},
{
text: 'Last Name',
type: 'column',
field: 'surName',
editor: false,
},
]
I am not sure if this is a bug or inconsistency. Defining the columns as read-only using the readOnly property does not make the columns non-editable.
Also, if we make the grid read-only using the readOnly property as true, we can also set the column's readOnly property as true.
If we do not define the readOnly property of the grid, but we define the readOnly property in the column as true, like shown below:
readOnly on the column doesn't mean what you think (it's inherited from Model), you should use 'editor: false' to set a column as non-editable. We'll see if we can improve docs to make this more clear.