Insert column option disable in context menu

Tags: #<Tag:0x00007efc72fb78c0> #<Tag:0x00007efc72fb7780>

Hi there,
I want to know why insert/remove column options are disable from context-menu. and how to enable them

Hi @rupeshfend

I believe your data set is in a form of array of objects. In this case only inserting/removing rows operation is allowed.

1 Like

ok, I am using the data set is in a form of Array of arrays, it’s allowing me to insert/remove rows, But not allowing to insert/remove columns

Please share a code demo showing your current configuration, so I can determine what the problem is.

1 Like

Hey, I have created the demo, please check and let me know how can I made the column insertion and removal enable without affecting my dataset structure.
[Dummy Handson - StackBlitz](https://stackblitz.com/edit/handsontable-angular-n6wuv9?file=app%2Fapp.component.ts)

Hi @rupeshfend

Thank you for the example. I checked it, and your dataset is array of objects. In this case the alter method won’t work for columns alteration. In this case you would need to use updateSettings method to update the columns number and create a custom context menu to apply this logic.

1 Like

Hey, check this example of having dataset as array of array, still column insertion and removal is disable, https://stackblitz.com/edit/handsontable-angular-n6wuv9?file=app%2Fapp.component.ts

Yes, but you still have the columns option defined, and that changes the structure by itself. I would still recommend using the approach I proposed in my previous message.

It will be helpful for me, if you provide me a demo on jsfiddle or any other platform.

@rupeshfend

I am not able to prepare custom code examples. I can only guide on what to use, and as I mentioned it should be done with the updateSettings and then updating the columns configuration. It also strongly depends on your requirements and implementation.

Here you can find an example showing how to build a custom context menu: https://handsontable.com/docs/javascript-data-grid/context-menu/#context-menu-with-a-fully-custom-configuration