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
{{ message }}
Repository navigation
Ionic 4 ion-item-sliding stops sliding after list is updated #16824
Same bug as reported earlier but that does not fix the core issue but rather uses a workaround.
Expected behavior:
After the list is refreshed/updated, the elements should still be slide-able.
Steps to reproduce:
Create an <ion-list> of <ion-item-sliding> elements
Open the slide menu of one of the elements
Have the app update the list in the background (reassign the list variable)
The list refreshes and the elements are not able to use the slide gesture.
Related code:
// HTML
<ion-list>
<ion-item-sliding *ngFor='let a of list'>
<ion-item>
<ion-text>{{a}}</ion-text>
</ion-item>
<ion-item-options side="end">
<ion-item-option color="danger">
<ion-icon name="trash"></ion-icon>
Delete
</ion-item-option>
</ion-item-options>
</ion-item-sliding>
</ion-list>
// COMPONENT/PAGE
public list: string[] = ['A', 'B', 'C'];
// use a short delay to update list after opening up the slide item
this.list = ['A', 'B', 'C', 'D'];
Thanks, I can likely use that. However the thing is I don't want to (and shouldn't have to) close the sliding items whenever the list is updated.
I have a list that is frequently being updated and would like the item to stay in the "open slide out" state if the user performed the action, even if there is a modification to the list.
I've noticed the same thing happens regardless of whether there is an addition or removal to the list. If the list is assigned to an equivalent list, the same issue occurs.
Reacted by Mr Tung, William Ghelfi, Andrii Bilozor and Novoselov Artem
I've created 2 options for sliding, and when one option is selected (click) I call an AlertController to show some options, like edit the item. After edit, and confirm changes in AlertController I update the array used to display the ion-list, after this cannot slide, until app is reopened.
I want add to that cfguimaraes noted: if I modify the item without add or remove element, slide does not disappear but slide doesn't not go back in no sliding position despite list has been updated. To be more clear, AFTER the update the screen remain as the image
plusOne() takes Map key and increments it (Map.prototype.set()) by one. At this point, I think the full list gets repainted and when it comes back it can't slide.
P.S. here, the user should be able to press plusOne(key) as many times as desired, it's not like a 'delete button', but a 'I want more of this' one.
Just tried with the 4.0.2 release which contains the above mentioned fix. The sliding items don't appear to be getting stuck after updating the list. It does seem to automatically close the sliding menu when the list is updated though, similar to the workaround mentioned at the beginning of this thread.
I'll close this issue as it the fix works for me. If anyone is not satisfied with this, they can open up a new issue.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Activity
Majed93 commentedon Dec 19, 2018
You could try the workaround from here
#15486 (comment)
This issue is when an item is removed however but worth a try.
OJ7 commentedon Dec 20, 2018
Thanks, I can likely use that. However the thing is I don't want to (and shouldn't have to) close the sliding items whenever the list is updated.
I have a list that is frequently being updated and would like the item to stay in the "open slide out" state if the user performed the action, even if there is a modification to the list.
I've noticed the same thing happens regardless of whether there is an addition or removal to the list. If the list is assigned to an equivalent list, the same issue occurs.
dylanvdmerwe commentedon Jan 9, 2019
A work around is here: #15486 (comment)
Verified that the work around does do the trick. But it should not be necessary.
cfguimaraes commentedon Jan 20, 2019
Hi all, I've this same issue.
I've created 2 options for sliding, and when one option is selected (click) I call an AlertController to show some options, like edit the item. After edit, and confirm changes in AlertController I update the array used to display the ion-list, after this cannot slide, until app is reopened.
Is there something I can help?
pimol commentedon Jan 23, 2019
I want add to that cfguimaraes noted: if I modify the item without add or remove element, slide does not disappear but slide doesn't not go back in no sliding position despite list has been updated. To be more clear, AFTER the update the screen remain as the image
mautematico commentedon Jan 29, 2019
Same issue here, with a variant:
I am iterating over a Map like this (Tickets.newTicket is a Map<Object, number>) :
plusOne() takes Map key and increments it (
Map.prototype.set()) by one. At this point, I think the full list gets repainted and when it comes back it can't slide.P.S. here, the user should be able to press plusOne(key) as many times as desired, it's not like a 'delete button', but a 'I want more of this' one.
OJ7 commentedon Feb 19, 2019
Ionic has pushed a fix for a similar issue that will be released in
4.1.0. I will test it out after it is released to see if it fixes this issue too.OJ7 commentedon Feb 20, 2019
Just tried with the
4.0.2release which contains the above mentioned fix. The sliding items don't appear to be getting stuck after updating the list. It does seem to automatically close the sliding menu when the list is updated though, similar to the workaround mentioned at the beginning of this thread.I'll close this issue as it the fix works for me. If anyone is not satisfied with this, they can open up a new issue.
ionitron-bot commentedon Mar 22, 2019
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.