浏览代码

HUE-7949 [dashboard] Update Gridster model after deleting a widget

Enrico Berti 7 年之前
父节点
当前提交
ccfe80d233
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      desktop/libs/dashboard/src/dashboard/templates/common_search.mako

+ 4 - 1
desktop/libs/dashboard/src/dashboard/templates/common_search.mako

@@ -4241,7 +4241,10 @@ $(document).ready(function () {
     for (var i = 1; i <= siblings.length; i++) {
       var widget = siblings[i - 1];
       $gridster.resize_widget($(widget.gridsterElement), optimalWidgetWidth, widget.size_y());
-      $gridster.move_widget($(widget.gridsterElement), ((i - 1) * optimalWidgetWidth) + 1, widget.row());
+      widget.size_x(optimalWidgetWidth);
+      var newCol = ((i - 1) * optimalWidgetWidth) + 1;
+      $gridster.move_widget($(widget.gridsterElement), newCol, widget.row());
+      widget.col(newCol);
     }
     searchViewModel.gridItems.remove(gridElement);
     huePubSub.publish('gridster.clean.whitespace');