[TYPO3-german] Re: Extbase: Sortierung von Kindobjekten
David Brünner
david.bruenner at t-online.de
Sun Mar 11 17:52:12 CET 2018
Das ist das JS, das das hidden Feld 'swappedItems' mit den korrekten Werten setzt:
[code]
// move listEntry up/down
$('.listEntry.actions').on('click', '.move', function() {
var swappedItems = null;
if ($('input[type="hidden"][name*="swappedItems"]').length) {
// get item of clicked row
var row = $(this).parents('tr');
var move = $(this).hasClass('moveUp') ? 'up' : 'down';
var swapWithItem = null;
if (move == 'up') {
swapWithItem = row.prev('tr');
swapWithItem.before(row);
} else {
swapWithItem = row.next('tr');
swapWithItem.after(row);
}
// get order of all entries
var items = [];
$(this).parents('tbody').first().find('tr').each(function () {
items.push($(this).attr('data-uid'));
});
swappedItems = $('input[type="hidden"][name*="swappedItems"]');
var tmp = {};
tmp[$(this).parents('tbody').first().attr('data-uid')] = items;
swappedItems.val(JSON.stringify(tmp));
}
});
[/code]
More information about the TYPO3-german
mailing list