version === prevVersion) {
common.tables.history.rows.load(items);
} else {
- libft.destroyTable("history");
- // Is there a way to get an event when the table is destroyed?
- setTimeout(() => {
+ libft.destroyTable("history").then(() => {
libft.initHistoryTable(data, items, "history", get_history_columns(data), false,
() => {
$("#history .ft-columns-dropdown .btn-dropdown-apply").removeAttr("disabled");
ui.updateHistoryControlsState();
});
- }, 200);
+ });
}
prevVersion = version;
} else {
$("#" + table + " .ft-columns-btn.show").trigger("click.bs.dropdown"); // Hide dropdown
$("#" + table + " .ft-columns-btn").attr("disabled", true);
if (common.tables[table]) {
- common.tables[table].destroy();
+ const promise = common.tables[table].destroy();
delete common.tables[table];
+ return promise;
}
+ return new $.Deferred().resolve().promise();
};
ui.initHistoryTable = function (data, items, table, columnsDefault, expandFirst, postdrawCallback) {