Want to make combination of coulmn readOnly and editable

Tags: #<Tag:0x00007f135fa5e0f0>

I have a project requirement where, I have a Handsontable with data, with columns read-only, Now I want to add column insert options in dropdown menu and the columns those are newly added only that will be editable.

Any kind of help will be appreciated.

Hi @avi98op

Here’s Aleksandra from the Technical Support team.

Do you use columns in your configuration to add the read-only state or other methods, like cells or afterSetCellMeta() call?

Hi @aleksandra_budnik

I am new to handsontable, what I want is the columns along with the data that I have initially are readOnly , that is what I have coded. Now only those column that I am adding using dropdownMenu: [‘col_left’ , ‘col_right’] this 2 option I my table I want those column only to be editable. is there a way to do that

No worries. I’ll do my best to explain everything.

We should start with data types as it determines the way you can work with columns.

Here https://jsfiddle.net/handsoncode/svdu921q/ we use an array data, and when you open the dropdown menu you can add/remove a column and make it readOnly.

07

And if your data is an object like here https://jsfiddle.net/handsoncode/svdu921q/1/ the column addition/deletion is blocked.

48

Now, based on the use of array data you can define readOnly false for the whole dataset, and then use afterCreateCol hook to make the new column editable. Here’s a demo https://jsfiddle.net/handsoncode/6Ldxq7ev/

Thanks for your help!, its working as I was expecting.

I’m happy to hear that.

If you need anything please feel free to open a new thread here or contact us at support@handsontable.com