This is a migrated thread and some comments may be shown as answers.

Accessing whether column is editable or not

1 Answer 139 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 06 Sep 2018, 08:07 PM

I'm using a modified example of the in row editing. When a cell is clicked I switch the row to edit mode. I've inspected both the cellRender and rowRender methods and I don't see any properties to indicate the editable={false} from my GridColumn props. The cell rendering routine must know this in order to control the display. Is there a property I am overlooking?

I want to preventing switching my row to edit mode if the cell clicked is not editable. Help appreciated. See my example on stackblitz. When clicking a cell it shows the editField in the header which is what I want to prevent on the click of a non-editable cell (all are marked as editable false here).

https://stackblitz.com/edit/react-nte6fd?file=app/main.js

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 07 Sep 2018, 08:37 AM
Hello, Ryan,

Currently, there are two approaches to do this:

1) Have an array with editable columns, and based on the editField form the cellRender determine if this column is editable or not depending on if it is in the editable columns array.

2) Every column that has editable set to false has the editor property in the dataItem set to undefined. In the cellRender, check if the editor property has value and if it does then this is an editable column.

Also, we do have a discussion to determine if we should pass all of the column properties do the cell. This has its advantages and disadvantages are we are observing which one is better to decide if we are going to pass all of the props down to the components.

Regards,
Stefan
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Ryan
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or