handsontable 自定义右键菜单

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
hot1.updateSettings({
contextMenu: {
callback: function (key, options) {
console.log(key);
if (key === 'ColType') {
setTimeout(function () {
//timeout is used to make sure the menu collapsed before alert is shown
alert("This is a context menu with default and custom options mixed");
}, 100);
}
},
items: {
// 上面插入一行
"row_above": {},
// 下面插入一行
"row_below": {},
"hsep1": "---------",
// 左侧插入一列
"col_left":{},
// 右侧插入一列
"col_right":{},
"hsep2": "---------",
// 删除行
"remove_row":{},
// 删除列
"remove_col":{},
"hsep3": "---------",
"undo":{},
"redo":{},
"make_read_only": {},
// 单元格对齐方式
//"alignment": {},
"commentsAddEdit": {},
// 合并单元格菜单
"mergeCells": {},
"hsep2": "---------",
// 自定义菜单
"ColType": {
name: 'ColType',
}
}
}
});
坚持原创技术分享,您的支持将鼓励我继续创作!