Ion item in list, cancel / restore swipe after clicked


#1

Hi, all

Extent from the post here:

Just wondering is there any way that I can do:

  • Swipe to show the options button
  • After the options button show, click the item (or any other items) will cancel the swipe effect ( Just like the same effect like Dave provided in above post)

This will give better user experience imo, like within a list:

swipe -> options -> click anywhere within list to cancel swipe -> click the list item to call other function

Some Suggestions

In Dave’s solution, it add a option-buttons attribute to list item, watch it, then cancel the swipe effect on others click. So if swipe happened, need to click twice to cancel the swipe effect.

Currently the swipe directive from Ionic doesn’t give any attribute that can be watched, so it’s not able to watch the change after swiped. The only attribute I found is the style attribute with <div class="item-content"> within the list item, don’t think this is a correct approach, even not in the big list.

Is is possible to provide a attribute within <ion-item>, which like swiped = "boolean" , therefore it can be watched to extend any custom action.

Hope I do explain it clear. Thanks for advice