Core
Handsontable
类(称为core
)允许您使用Handsontable公共API方法修改网格的行为。
调用方法:
// 创建Handsontable实例
const hot = new Handsontable(document.getElementById('example'), options);
// 调用一个方法
hot.setDataAtCell(0, 0, 'new value');
方法
1:addHook
core.addHook(键,回调)
hot.addHook('beforeInit', myCallback);
2:addHookOnce
core.addHookOnce(键,回调)
触发后,自动被删除。
hot.addHookOnce('beforeInit', myCallback);
3:alter
core.alter(action,[index],[amount],[source],[keepEmptyRows])
通过在指定位置添加或删除行和列来更改网格的结构。
//在第10行上方(按visual index),插入1个新行
hot.alter('insert_row_above', 10);
使用index |
没有index |
|
'insert_row_above' | 在index上面插入一行 |
在第一行上面插入一行 |
'insert_row_below' | 在index下面插入一行 |
在第最后一行下面插入一行 |
'remove_row' | 从index 开始,删除行 |
从最后一行开始删除行。 |
'insert_col_start' | 在index前插入一列 |
在第一列前插入一列 |
'insert_col_end' | 在index后插入一列 |
在最后一列后插入一列 |
'remove_col' | 从index 开始,删除列 |
从最后一列开始删除列 |