Premium support for our pure JavaScript UI components


Post by jitendra.singh »

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.


Post by marcio »

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


Post by jitendra.singh »

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.


Post by mats »

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.


Post by jitendra.singh »

Thanks,
I have one more question regarding cellEdit.
Let's say we have a grid with columns, and we are handling the editing of cells with the "beforeCellEditStart" event. Could you suggest how we can check whether a particular cell is editable or not during rendering?


Post by tasnim »

Hi,

Could you please open a separate post for that new question? We have a policy that is one-post-per-issue to simplify the workflow and support.

Let's create a new post on the new question to maintain the policy

Good Luck :)


Post Reply