如何使用gridster 2

时间:2019-09-09 07:00:39

标签: angular angular-gridster2

我有以下网格=>

  dashboard: Array<GridsterItemCustom> = [
    {cols: 4, rows: 10, y: 0, x: 1, type: NavigationMiniMapComponent, inputs: { synchGroupId : this.synchGroupId}, name: 'MINIMAP_NAME', id: 'waypoint'},
    {cols: 4, rows: 10, y: 0, x: 5, type: NavigationVrMapComponent, inputs: { synchGroupId : this.synchGroupId}, name: 'VRMAP_NAME', id: 'vrMap'},
    {cols: 1, rows: 3, y: 7, x: 0, type: NavigationWaypointUiComponent, name: 'WAYPOINT_INFO_NAME', id: 'informationn'},
    {cols: 1, rows: 3, y: 1, x: 0, type: NavigationDroneUiComponent, name: 'DRONE_INFO_NAME', id: 'droneNav'},
    {cols: 1, rows: 3, y: 4, x: 0, type: NavigationMissionUiComponent, name: 'ROUTE_INFO_NAME', id: 'routes'},
    {cols: 1, rows: 1, y: 0, x: 0, dragEnabled: false, resizeEnabled: false, type: NavigationMenuComponent, name: '', id: 'planMenu'},
  ];

当用户单击按钮时,我想添加一个新元素(并调整其他每个元素的大小,以便显示我的元素:

 onclick(value)
  if (value) {
    this.dashboard.push({cols: 4, rows: 5, y: 0, x: 1, type: NavigationRealMapComponent, name: 'REALMAP_NAME', id: 'videocam'});
  }
  if (!value) {
    const index = this.dashboard.findIndex(e => e.id === 'videocam');
    if (index > -1) {
      this.dashboard.splice(index, 1);
    }
  }
}

基本上,所有当前要放置新元素的元素将被调整大小。

有没有一种方法可以从包装内完成?还是我必须自定义功能?

现在代码将这个扔给我

  

angular-gridster2.js:1649无法放置在   仪表板,尝试自动定位!/ n {“ cols”:4,“ rows”:5,“ x”:1,“ y”:0}   angular-gridster2.js:1804无法放置在   仪表板!/ n {“ cols”:4,“ rows”:5,“ x”:1,“ y”:0}

0 个答案:

没有答案