ng2-dragula icon indicating copy to clipboard operation
ng2-dragula copied to clipboard

drop model updating model condition updates to be inside ngFor and fires dropModel twice.

Open sch58111 opened this issue 7 years ago • 2 comments

REQUIRED: Before filing a usage question

Change each [ ] to [x] when you have done it.

Use case description (required) I have created a Drag and drop ui that allows users to create rows, columns and inputs (and drag rows, columns and inputs) . So rows are vertically stacked, columns are horizontally inside rows but can be dragged and dropped into different rows. Inputs are horizontally stacked inside columns but can be dragged to different columns in the same row or different row.... I have "row: number" in my column model and I have "order: number", "col: number" and "row: number" in my input as you can drag an input within the column, to another column in the same row or a column in a different row. When I update the model using dropModel - it updates the view and shows two inputs / cols / rows instead of the one I just dropped.

So if I update the row, column of an input for example or the row index of a column upon drop model it updates my local model which makes it fit in the ngFor let col of cols> <div *ngIf="row.index === col.rowIndex"> this shows up twice...

A clear and concise description of what you want to achieve.

Can you show a demo, or a picture of what you want to achieve?

If so, please link it here.

Additional context

Add any other context here.

sch58111 avatar Aug 20 '18 02:08 sch58111

Do make sure you’re on v2.0.2. If you looked at closed issues like you confirmed, you would find a couple of issues like this.

cormacrelf avatar Aug 20 '18 21:08 cormacrelf

@cormacrelf I have confirmed I'm on v2.0.2 "ng2-dragula": "^2.0.2", - the issues I saw didn't represent the usage question I'm having

I have rows, cols, and inputs

screen has rows have many cols, cols have many inputs.... so I loop through my rows - ngFor="let row of rows" and i have a div where ngfor col of cols -then my next div checks ngIf="col.row === row.index" (this makes sure i only show the columns that are in that row - When I drag a column to a new row (i.e. dropModel) I update the col.row property - which means it shows up in my ngFor (the dropped one and the second one because the updated model)

sch58111 avatar Aug 20 '18 22:08 sch58111