Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
$(function () {
let $gridEl = $('.persons-list'),
sortByName = (el) => {
return el.getAttribute('data-name').toLowerCase();
},
sortByGroup = (el) => {
return el.getAttribute('data-group-names').toLowerCase();
},
grid = new Shuffle($gridEl, {
itemSelector: 'li.person',
isCentered: false,
initialSort: {by: sortByName}
});
$gridEl.css("min-height", $gridEl.height() + "px");
let $sortSelector = $(".sort-selector");
$sortSelector.find("a").click((ev) => {
ev.preventDefault();
let $selectedNode = $(ev.currentTarget),
sort = $selectedNode.data("sort");
$sortSelector.find(".current-mode").text($selectedNode.text());
if (sort === 'name') {
grid.sort({by: sortByName});
}