-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(sortable): sortable should be refreshed when a new item is added to the array #1716
Comments
Workaround: Call manually to writeValue of the SortableComponent import { Component, ViewChild } from '@angular/core';
@Component({
selector: 'custom-item-template-demo',
templateUrl: './custom-item-template.html'
})
export class CustomItemTemplateDemoComponent {
public itemStringsLeft: any[] = [
'Windstorm',
'Bombasto',
'Magneta',
'Tornado'
];
@ViewChild(SortableComponent) sortableComponent: SortableComponent;
public addItem() {
this.itemStringsLeft.push("new item");
this.sortableComponent.writeValue(this.itemStringsLeft);
}
} |
@Vrael I am also having the same issue. Is it going to be fixed or we will have to stick with the workaround? Thanks! |
Sortable is an experimental component, fully reworked version of it is on the way |
Using this too. Workaround ok. Thx again for the AWESOME work Valor. |
When I try the workaround @ViewChild(SortableComponent) sortableComponent: SortableComponent; |
@valorkin when is this fully reworked version planned for release? |
This year :) |
Thanks for the respone. It would be great if this is released this month hopefully. |
Hi @valorkin Being able to disable specific elements at a specific index from being rearranged is something that I (and I assume many others) are going to need. :) |
I am planning to decompose DND functionality to allow more flexibility |
When item is removed from the model's array then sortable should be refreshed too or provide method to refresh manually. BTW is there now any workaround? |
Another workaround, (and it's just more logical) is to re-create the array each time you want to modify it. Replacing the reference triggers the bs-sortable component refresh mechanism.
|
Sortable component only shows initial array elements. When a new value is pushed into array, the sortable does not display it.
The text was updated successfully, but these errors were encountered: