Context menu customizations - Nested row context actions

Tags: #<Tag:0x00007efc72ee00c8>

Hi,

I’m trying to customize Context menu with my own actions, but the problem I’m facing is that there are no string constants for Context actions for Nested rows: “Insert child row” and “Detach from parent”.
So I can’t customize it in a way that I just have the actions I want plus my customized actions.

  1. Is there a way to add Nested rows context actions in customized context menu?
  2. Is there maybe a way to render the whole Context menu and then remove some actions and add some custom ones ?

Regards,
Luka

Hi @luka.kolega
I think that if you want to show different options for child and parent rows you may want to use this demo: http://jsfiddle.net/mLy9k607/
Here’s an example for columns but you can easily refer to a row as well

Hi @aleksandra_budnik

I’m not sure that you understood what is the problem.
I know how to show/hide existing actions, add custom actions, and so on.

The problem is that two Context actions that refer to Nested Rows add in (Insert child row and Detach from parent) don’t have predefined text commands as all others have.

Example:
‘col_left’ is a predefined text command for action: Insert column on the left
‘col_right’ is a predefined text command for action: Insert column on the right

I need the same for menu actions:
Insert child row
Detach from parent

Without those, I can’t customize the Context menu the way I want.

Regards,
Luka

The nested rows command are pretty much similar: detach_from_parent, add_child
You can test them at: http://jsfiddle.net/y0Lob1rz/.
Is that what you were looking for, or you want to overwrite the following command with your custom code?

That is what I was looking for.
I tried that but it didn’t work, but I didn’t install the latest version so maybe that’s the issue.
I’ll try installing the latest version and get back to you.

We did not change anything related in the latest version but fixed some other issues so if you can update easily it’s a good choice to do it. I am happy that it works now.

If you would have any other questions feel free to open a new topic.

It still doesn’t work.

So if I use it the way it’s used in the example it works:
contextMenu: [‘row_above’, ‘row_below’,‘remove_row’, ‘---------’, ‘detach_from_parent’, ‘add_child’],

But if I use it like this:
contextMenu: {
callback: function (key, options) {
if (key === ‘indent_plus’) {
alert(’+’);
};
if (key === ‘indent_minus’) {
alert(’-’);
};
},
items: {
“add_child”: {},
“detach_from_parent”: {},
“hsep1”: “---------”,
“row_above”: {},
“row_below”: {},
“hsep2”: “---------”,
“remove_row”: {},
“hsep3”: “---------”,
“indent_plus”: { name: ‘Indent +’ },
“indent_minus”: { name: ‘Indent -’ },
}
}

It’s not working.

You can try it in jsFiddle.

If you define items as an array it works as expected. Please check this demo: http://jsfiddle.net/m1Lbw6h1/

Thanks a lot.
It works this way.

You can close it.

OK. Thanks for confirmation.
I’m closing this issue.