小编Jan*_*niH的帖子

如何在静态函数中调整大小/更改时将 gridster-item 保存在数据库中?

在我的仪表板上执行一些调整大小/拖动操作后,我想在我的 MongoDB 数据库中保存我更改的小部件的更新大小和位置。幸运的是,gridster 库可以对可拖动和调整大小的事件做出反应。但不幸的是它们是静态的,所以当我想通过使用我的数据库服务保存新值时,它不起作用,因为它不能使用它,因为它不是静态的。

我使用了 Angular 6 和 angular-gridster2 6.0.10。

有谁知道如何使用调整大小/拖动事件来保存我的数据?


这是代码(不可运行,因为我减少了很多):

export class SheetContentComponent implements OnInit {

  constructor(protected databaseService: DatabaseService,
              private dataService: DataService,
              protected projectService: ProjectService) {
  }

  protected widgetType = WidgetType;
  protected project: Project;
  protected currentDashboardId: string;
  protected user: User;
  protected currentSheetId: string;
  protected widgetPosition: GridsterItem;
  protected currentWidgetId: string;

  protected dashboard: Array<GridsterItem>;

  ngOnInit(): void {

    this.options = {
 gridType: GridType.Fit,
      displayGrid: DisplayGrid.Always,
      compactType: CompactType.None,
      margin: 10,
      outerMargin: true,
      minCols: 50,
      maxCols: 200,
      minRows: 50,
      maxRows: 100,
      pushItems: true, …
Run Code Online (Sandbox Code Playgroud)

draggable resizable typescript angular angular-gridster2

2
推荐指数
1
解决办法
3211
查看次数