Context menu

Tags: #<Tag:0x00007efc60a50d30>

Hi,

In the context menu, can i create the insert row and remove row option with multiple names, with same insert and remove functionality.
Like i want insert function, insert name and remove function, remove name etc…with same insert and remove functionality.

i have created a custom context option for insert and remove like:

‘custom_item_three’ :
{
name: ‘insert failure mode’,
callback: function(key,selection)
{
this.alter(“insert_row”,selection.end.row()+1)
}
},
‘custom_item_six’ :
{
name: ‘remove failure mode’,
callback: function(key,selection)
{
var amount = selection.end.row() - selection.start.row() + 1;
this.alter(‘this.remove_row’, selection.start.row(), amount);
}
},

but i am getting a error, “Unable to get property ‘row’ of undefined or null reference”. How do i fix this?

Hey @chandan09121995

here’s the fixed example http://jsfiddle.net/z5y47mdc/

  1. row is a number, not a function
  2. the quotes differed
  3. selection is an array, I’ve used the first element of it to access the alter method.

@aleksandra_budnik Thank you so much for the explanation and the example, it really helped.

You’re welcome @chandan09121995
I’m happy it helped.