【发布时间】:2015-09-09 06:08:27
【问题描述】:
我有一个带有mergeCells 选项的 HandsOnTable,在特定事件中我进行了服务器调用,它为我提供了更新的数据,因此也需要更新合并单元格选项。
例如在服务器调用之前,分组是每 5 行,但之后是 4 行。
我使用了hot.updateSettings(hotOptions),其中mergeCells的hotOptions被更新了,但它没有更新设置。
服务器调用前:
var hotOptions =
{
data: Handsontable.helper.createSpreadsheetData(5,5),
colWidths: [47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47],
rowHeaders: true,
colHeaders: true,
contextMenu: true,
mergeCells: [
{row: 0, col: 0, rowspan: 2, colspan: 2},
{row: 3, col: 3, rowspan: 2, colspan: 2}
]
};
hot = new Handsontable(container, hotOptions);
服务器调用后:
hotOptions.mergeCells = [
{row: 0, col: 0, rowspan: 3, colspan: 3},
{row: 0, col: 3, rowspan: 2, colspan: 1}
];
//just to prove that data is updating
hotOptions.colWidths = [100, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47];
hot.updateSettings(hotOptions);
我可以销毁较早的 HOT 实例并使用新选项创建新实例(附加的小提琴就是这样做的),但我想用 updateSettings 实现同样的效果。
更多详情:http://jsfiddle.net/ru53zo3o/1/
【问题讨论】:
-
看起来这是 HandsOnTable 的一个已知问题,他们将在即将发布的版本(即 0.15.1)中修复它。我们可以通过以下方式跟踪 chagnes:github.com/handsontable/handsontable/issues/1788
标签: handsontable