Calback not working Swipeout in Framework7

Asked

Viewed 29 times

0

page commands.html

      <div class="list">
      <ul>
          <li class="swipeout deleted-callback">
              <div class="item-content swipeout-content">
                <div class="item-inner">
                  <div class="item-title">Porção Fritas M</div>
                <div class="item-after">R$ 4,90</div>
              </div>         
              </div>
              <div class="swipeout-actions-right">
                <a href="#" data-confirm-title="Atenção!" data-confirm="Deseja remover este item?" class="swipeout-delete swipeout-close">Excluir</a>
              </div>
          </li>
      </ul>         
    </div>

app file.js

var $$ = Dom7;

var app = new Framework7({
  root: '#app', 
  id: 'com.comanda.app', 
  name: 'Comanda', 
  theme: 'ios', 
  panel: {
    swipe: 'left',
    swipeActiveArea: 80,
  },
  swipeout: {
    removeElements: true
  },
  routes: routes,
});

var homeView = app.views.create('#view-home', {
  url: '/'
});
var cardapioView = app.views.create('#view-cardapio', {
  url: '/cardapio/'
});
var estoqueView = app.views.create('#view-estoque', {
  url: '/estoque/'
});
var configView = app.views.create('#view-config', {
  url: '/config/'
});       

// AQUI NÃO FUNCIONA 
$$('.deleted-callback').on('swipeout:deleted', function () {
  app.dialog.alert('Item removido!');
});

The exclusion callback wouldn’t be working. I do not understand where you are making a mistake because I did according to the documentation

1 answer

1


Do it like this:

$$(document).on('swipeout:deleted','li[id^="deleted"]' ,function() {
  <!-- Função  -->
})

Browser other questions tagged

You are not signed in. Login or sign up in order to post.