Giter VIP home page Giter VIP logo

Comments (6)

loebi-ch avatar loebi-ch commented on August 30, 2024

I'm very sorry for this imprecise bug report.

In the meantime I setup a brand new Angular "Hello World" project and realized that ng-sortgrid works with Angular version 13.2.4.
So I went deeper in root cause analyses and found out what causes the issue I encountered in my project.

Generally, I use Angular's CDK Drag'n'Drop functionality to make blocks in vertical order sortable. Inside one of these blocks I have a grid that I made sortable with ng-sortgrid because Angular Drag'n'Drop functionality with display: flex; flex-wrap: wrap is still a big pain in the ass.

So far this worked like a charm, but with upgrading Angular from version 13.2.3 to 13.2.4 ng-sortgrid functionality broke completely, because mouse events were not recognized anymore with ng-sortgrid.
When I remove Angular's CDK Drag'n'Drop functionality in the parent's DIV, ng-sortgrid works again.

I don't have a solution yet, but it has absolutely nothing to do with ng-sortgrid, so I close this issue.

from ng-sortgrid.

kreuzerk avatar kreuzerk commented on August 30, 2024

@loebi-ch. Wow. Thx a lot for the research and the awesome explanation. Glad to hear that it works. I already started researching a bit but couldn't figure out a solution. But thx to your explanation everything makes perfect sense now. Thx a lot 👍

from ng-sortgrid.

loebi-ch avatar loebi-ch commented on August 30, 2024

I've found the root cause in Angular's cdk/drag-drop/drag-ref.ts
In Angular CDK version 13.2.4 they've added a line to preventDefault() on dragstart event.

image

If I comment out the above line again, ng-sortgrid works again.

from ng-sortgrid.

loebi-ch avatar loebi-ch commented on August 30, 2024

I opened a new bug report within angular/components:
angular/components#24533

from ng-sortgrid.

kreuzerk avatar kreuzerk commented on August 30, 2024

👍

from ng-sortgrid.

loebi-ch avatar loebi-ch commented on August 30, 2024

I have found a solution:

Use (dragstart)="$event.stopPropagation()" within cdkDrag element:

<div cdkDropList>
	 <div class="block" cdkDrag>
		<span cdkDragHandle>:</span> Block 1
	 </div>
	 <div class="block" cdkDrag>
		<span cdkDragHandle>:</span> Block 2
		<ul (dragstart)="$event.stopPropagation()">
			<li *ngFor="let item of items" ngSortgridItem [ngSortGridItems]="items">List Item {{item}}</li>
		</ul>
	 </div>
</div>

from ng-sortgrid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.