Utilizing Angular CDK to link several drop zones together using the cdkDropListConnectedTo directive

Currently in the process of designing a basic board interface with swim lanes similar to Jira swimlane or trello boards

https://i.sstatic.net/7MBvm.png The red lines indicate the current flow

The blue lines represent the flow that I aim to implement

There are three columns labeled "To Do", "In Progress" and "Done". At the moment, I am able to drag an item from To Do to In Progress, from In Progress to Done, and from Done back to To Do using cdkDropListConnectedTo.

My question is how can I move an item from "Done" to "To Do" and "In Progress", and likewise, move an item from "In Progress" to both "Done" and "To Do", and from "Done" to both "In Progress" and "To Do"?

My initial thought was to pass multiple references to cdkDropListConnectedTo, but that approach did not yield the desired outcome. Any guidance in the right direction would be greatly appreciated.

Thank you

This is the progress I've made so far: https://stackblitz.com/edit/angular-mpedfr?file=src%2Fapp%2Fapp.component.html

Answer №1

You can now simplify your code by using a global container with the cdkDropListGroup attribute. This way, all child containers with the cdkDropList attribute are automatically linked together without the need to manually add the [cdkDropListConnectedTo] directive.

<div cdkDropListGroup>
    <div cdkDropList>
        <div cdkDrag>Drag Me</div>
    </div>
    <div cdkDropList>
        <div cdkDrag>Drag Me Also</div>
    </div>
    ...
</div>

Answer №2

It turns out that cdkDropListConnectedTo can connect to different dropzones, such as:

[cdkDropListConnectedTo]="[inProgress, done]"

For a complete example, check out: https://stackblitz.com/edit/angular-mpedfr

Answer №3

To link to various containers simultaneously, utilize the following code:

[cdkDropListConnectedTo]="[doneList,doneList1]"

Answer №4

Utilize the drop zones specified in cdkDropListConnectedTo

    <div class="board">
      <div class="lane lane-1" 
        cdkDropList 
        #todo="cdkDropList"
        [cdkDropListData]="toDoList"
        [cdkDropListConnectedTo]="[inProgress, done]"
        (cdkDropListDropped)="drop($event)"
        >
        <div class="heading todo">To Do</div>
        <div *ngFor="let item of toDoList" class="task"
           cdkDrag>{{item}}</div>
      </div>

      <div class="lane lane-2" 
        cdkDropList 
        #inProgress="cdkDropList"
        [cdkDropListData]="inProgressList"
        [cdkDropListConnectedTo]="[done,todo]"
        (cdkDropListDropped)="drop($event)"
        >
        <div class="heading doing">In Progress</div>
        <div *ngFor="let item of inProgressList" class="task" cdkDrag>{{item}}</div>
      </div>

      <div class="lane lane-2" 
        cdkDropList 
        #done="cdkDropList"
        [cdkDropListData]="doneList"
        [cdkDropListConnectedTo]="[todo,inProgress]"
        (cdkDropListDropped)="drop($event)"
        >
        <div class="heading done">Done</div>
        <div *ngFor="let item of doneList" class="task" cdkDrag>{{item}}</div>
      </div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Creating a unique, interactive network graph with d3js in the Ionic framework's "Blank" template page

Currently, I am working on integrating the code found at http://bl.ocks.org/jose187/4733747 into my Ionic/Angular project. Unfortunately, I am facing difficulties in getting the graph to render properly. The project is based on the "blank" template. Every ...

Make simultaneous edits to multiple cells in IGX GRID for Angular

Is it feasible to edit multiple cells in the same column simultaneously within igx grid Angular? I would like for the changes made within each cell to be displayed at the same time. Editing many cells all at once is a valuable feature! ...

Overriding Bootstrap Modals with PhaserJS Canvas

I am currently working on a simple game using phaserJs with Angular and styling it with bootstrap. The issue I'm facing is that when I display a bootstrap modal and interact with it, it affects the buttons on my phaserJS canvas. Here is an example pr ...

Using TypeScript to implement functions with multiple optional parameters

Imagine having a function like the one shown here: function addressCombo(street1:string, street2:string = "NA", street3?:string) { console.log("street1: " + street1); console.log("street1: " + street2); console.log("street2: " + street3); } I ...

Checkbox: Customize the appearance of the root element

I am trying to modify the root styles of a Checkbox component, but it is not working as expected. Here is my code: <CheckboxItem onChange={()} checked={isChecked} label="Show Checkb ...

I'm searching for the source code of Angular's `ViewContainerRef` - where can I locate it

I have been searching for the source code of Angular on GitHub, but I haven't been able to locate it. Could someone help me find it? view_container_ref only seems to provide the function name, but I am interested in understanding how the ViewContaine ...

How can I incorporate MS Teams call recording into my web platform?

Currently in the process of developing a web application using Angular. Successfully integrated video call functionality through Azure Communication. Looking to now incorporate MS Teams call recording feature. Seeking assistance with reference links and s ...

Typescript error: The value "X" cannot be assigned to this type, as the properties of "Y" are not compatible

Disclaimer: I am relatively new to Angular2 and typescript, so please bear with me for any errors. The Challenge: My current task involves subtracting a start date/time from an end date/time, using the result in a formula for my calculation displayed as " ...

Using data analysis to customize the appearance of boundaries across various map styles - Google Maps Javascript API V3

Utilizing data-driven styling for boundaries in Google Maps Javascript API V3 is a fantastic feature that appears to be compatible with all map types such as terrain, satellite, and hybrid. Nevertheless, I have encountered difficulties in making it visible ...

Having trouble retrieving certain header values in Angular 4

Using Angular 4, I am making a back-end query like this: this.classzService.query({ page: this.page, size: this.itemsPerPage, sort: this.sort(), url: url }).subscribe( (res: Response) => this.onQuerySuccess(res.jso ...

Utilizing combinedReducers will not prompt a re-render when dispatching actions

When I refrain from using combineReducers: const store = createStore<StoreState,any,any,any>(pointReducer, { points: 1, languageName: 'Points', }); function tick() { store.dispatch(gameTick()); requestAnimationFrame(tick) ...

Stylish elements within a higher-order component in a React application

Encountering two problems when using styled components within a higher order component wrapper in react. The component is being rendered without the specified background color. Encountering TypeScript errors with the ComponentWithAddedColors. Unable to id ...

Transforming an object's type into an array of different types

Looking to create an array of types based on object properties: type T = { a: number | string; b: string | number; c: number; d: boolean; }; Desired Output: [number | string, string | number, number, boolean] Intending to use this as a ...

How can the `!` operator be utilized in MikroORM Typescript entities?

How can I declare a key in a JS object with an ! before the colon? MikroORM syntax for class @Entity() export class Post { // Using @PrimaryKey() decorator to designate primary key @PrimaryKey() id!: number; @Property({ type: "date", de ...

What is the best way to retrieve an array of model objects utilizing a resolver?

I utilize a resolver to fetch data from the server import {Resolve, ActivatedRoute} from "@angular/router"; import {Observable} from "rxjs"; import {RouterStateSnapshot} from "@angular/router"; import {ActivatedRouteSnapshot} from "@angular/router"; imp ...

Can the garbage collector in Typescript/JavaScript effectively handle circular references, or does it result in memory leaks?

When working in languages such as C#, managing memory is not a problem. However, this can lead to difficult-to-find memory bugs in other languages. Is it safe to use the following code snippet in Typescript or Javascript without encountering any issues? c ...

typescript/raven.d.ts, at line 205, is throwing an error stating that it cannot recognize the name 'unknown' when attempting to install npm in an Ionic

During my work on an ionic project, I encountered this error while attempting to run npm install. https://i.sstatic.net/yHc04.png You can access the package.json file through this link: ...

Oops! Looks like an issue has popped up: using require() of an ES module is not supported when using recharts in combination with next.js

I've noticed some similar questions, but none of them seem to address my particular issue. I'm currently working on a webapp using next.js (with typescript). Within the app, I am utilizing recharts, however, I am encountering a compilation error: ...

What sets property binding with methods in Angular apart from using @Output() and EventEmitter?

Consider a scenario where I have a set of parent-child components in Angular structured like this: Child component class: export class ChildComponent { @Input() addTask:any; } Child component template: <button (click)="addTask('cleaning&a ...

Extracting arrays from JSON in Angular: A step-by-step guide

I am currently working with Angular2 (version 5) and facing an issue. I am able to make an HTTP request and receive JSON data. While I know how to access and use individual values, I am struggling with accessing and extracting the two arrays inside an elem ...