akserg / ng2-dnd

Angular 2 Drag-and-Drop without dependencies
MIT License
838 stars 251 forks source link

Drag item is not working in chrome(my chrome v is 64.0 #249

Open abhishekpandeykr opened 6 years ago

abhishekpandeykr commented 6 years ago

Its working in mozilla firefox but not in Google chrome

I am Trying to drag and drop the data in same column , I have tried all the possible answers given in https://github.com/akserg/ng2-dnd/issues/80, but i was failed, Please provide the solution for this. I am using version of ng2-dnd is 4.2.0

ghost commented 6 years ago

@abhishekpandeykr : This worked for me...i used ng2-dnd ! See if it works for you.. There are 2 lists.... you can drag (From names list ) and drop it into second list ( target list). The second list (target list) is sortable too!

Names List
  • {{item.name}}
<div class="col-sm-5">
    <div class="panel panel-success">
        <div class="panel-heading">Target List</div>
            <div class="panel-body" dnd-droppable (onDropSuccess)="addTo($event)" [dropZones]="['source-dropZone']" >
                <ul class="list-group" dnd-sortable-container [sortableData]="listTarget">
                    <li *ngFor="let target of listTarget; let j = index ; " class="list-group-item" dnd-sortable  [sortableIndex]="j" [dragData]="target">
                        <span >{{target.name}}</span>
                    </li>
                </ul>
            </div>
        </div>
    </div>  
addTo($event: any) { this.listTarget.push($event.dragData); } Angular version: 5.2.X Browser: Chrome XX
abhishekpandeykr commented 6 years ago

@vaishnavi-baliga In my case, there is only one list name list, the user can change the ranking of items by dragging the item. Please let me know what I am doing wrong, I have copied the code of simple sortable from ng2-dnd, pasted same code, but it was not giving result.kind of strange.

ghost commented 6 years ago

@abhishekpandeykr : refer this http://embed.plnkr.co/JbG8Si

import {Component} from '@angular/core';

@Component({ selector: 'simple-sortable', template: `

Simple sortable

Favorite drinks
  • {{item}}
My prefences:
{{i + 1}}) {{item}}
` }) export class SimpleSortableComponent { listOne: Array = ['Coffee', 'Orange Juice', 'Red Wine', 'Unhealty drink!', 'Water']; }
abhishekpandeykr commented 6 years ago

I have tries everything but no luck @vaishnavi-baliga same code is working in Mozilla