You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I have pagination on my page with bs-sortable component
When I drag item over page number page is switched and new collection is loaded to ngModel binded property
Then I try to drop this item back in bs-sortable (so just move it between pages) but instead of inserting this item in new collection it`s replaces existing one
On components page mentioned that original collection isn`t mutated and new collection is sended in onChange ad ngModelChange events, but in my project original collection is defenetly changed. Is it bedouse of me using old version or this is known issue?
The text was updated successfully, but these errors were encountered:
for now I've overcomed this problem by creating new collection with all items, including droped one, and assigning this collection to items of bs-sortable:
let items:any[] = [1,2,3,4,5];//bs-sortable binded to this collection
let items_copy:any[] = [];
ngOnInit() {
this.items_copy = this.items.slice();
}
//this function is called on bs-sortable onChange event
onDrop(event:any[]) {
let added = event.find(x=>this,items_copy.includes(x)== false);
if(added) {//item was droped from another page
let index = event.indexOf(added); //getting index of item that was replaced by new one
this.items_copy.splice(index+1,0,this.items_copy[index]); //inserting old item on it's place
this.items = this.items_copy.slice();
}
}
So I have pagination on my page with bs-sortable component
When I drag item over page number page is switched and new collection is loaded to ngModel binded property
Then I try to drop this item back in bs-sortable (so just move it between pages) but instead of inserting this item in new collection it`s replaces existing one
Plunker/StackBlitz that reproduces the issue:
https://stackblitz.com/edit/ngx-bootstrap-tqauje?file=app/app.component.html
Versions of ngx-bootstrap, Angular, and Bootstrap:
ngx-bootstrap: 5.6.2
Angular: Angular CLI: 7.0.5
Bootstrap: 4.1.1
Expected behavior
I Expect that new item will be added to collection just like in this demo:
https://valor-software.com/ngx-bootstrap/#/components/sortable#basic
Additional issue
On components page mentioned that original collection isn`t mutated and new collection is sended in onChange ad ngModelChange events, but in my project original collection is defenetly changed. Is it bedouse of me using old version or this is known issue?
The text was updated successfully, but these errors were encountered: