I have a sortable f7-list component with some list-groups inside.
Are there any methods to help me trace which list-group a list-item comes from?
Hi, here you have a solution, i didnt make it in f7-vue. But you can get the idea of how to make it your sef.
// Lets save previos group title
var sortablePreviosGroup = ''
// Hear at 'sortableSort', and trigger a dialog showing the previos group title
app.on('sortableSort', function (listEl, indexes) {
app.dialog.alert('My previos group was: ' + sortablePreviosGroup, 'Info')
})
// Bind the 'touchstart' event, when the page is rendered, if not '.sortable-handler' will not be in DOM
$(document).on('page:init', '.sortable-page', function (e) {
$('.sortable-handler').on('touchstart', function(e) {
// We get the li containing the '.sortable-handler'
var el = e.target.parentElement
// This will return an array of ALL the previos li with the class '.list-group-title', we only need the first of them
sortablePreviosGroup = $($(el).prevAll('.list-group-title')[0]).text()
})
})
Result:
3 Likes