Removing columns using context menu

Tags: #<Tag:0x00007f8b1dea7608>

Based on these posts:
isColumnModificationAllowed, RemoveColumn Grayed out in Context Menu

I understand the best way to remove column on a handsontable with predefined array of columns would be to override the callback function on the context menu.

I am trying to use the alter method like this:

          hotTable.alter('remove_col', selection.start.col, amount);

But I get the following error:

Error: cannot remove column with object data source or columns option specified
at DataMap.removeCol (http://localhost:4200/vendor.bundle.js:44275:11)
at Object.alter (http://localhost:4200/vendor.bundle.js:21615:19)
at Core.alter (http://localhost:4200/vendor.bundle.js:23351:10)
at Core.callback (http://localhost:4200/main.bundle.js:8427:64)
at http://localhost:4200/vendor.bundle.js:36239:25
at arrayEach (http://localhost:4200/vendor.bundle.js:8326:9)
at CommandExecutor.execute (http://localhost:4200/vendor.bundle.js:36238:28)
at ContextMenu.executeCommand (http://localhost:4200/vendor.bundle.js:51910:36)
at Menu. (http://localhost:4200/vendor.bundle.js:51777:40)
at http://localhost:4200/vendor.bundle.js:14521:25ERROR

Would you be open to modifying the removeCol definition to allow for some sort of override feature which would allow developers to call the removeCol function to delete columns?

Hi @sajmera

it is not a matter of using the alter method in a different way. It is modifying the columns array. Here is a simple example for adding columns http://jsfiddle.net/n5yhL77p/