Closed poetawd closed 5 years ago
Did you mean, programatically? I pretty sure there's an other way instead using jQuery. Actually I'd implemented that by removing an item and reinserting at desired order. First of all I return the sorting order of all items. Then I find, remove, and reinsert each item.
var sorting_order = [5,6,1,2,3];
var board_id = "_todo";
sorting_order.forEach(function (item_id) {
var oldElement = jkanban.findElement(item_id);
jkanban.removeElement(item_id);
jkanban.addElement(board_id, {
'id': item_id,
'title': oldElement.innerHTML
});
});
Awesome !
This is how I did it:
var $wrapper = $('.container'+id);
$wrapper.find('.item'+id).sort(function (a, b) {
var ta = a.getAttribute('data-prioridade');
var tb = b.getAttribute('data-prioridade');
if (sort === 'asc') {
return +ta - +tb;
} else {
return +tb - +ta;
}
}).appendTo($wrapper);
Is it possible to "sort" the itens inside a board ?
Or, is it possible to change the position of a item inside the board using javascript ?
I think that I can remove all itens and add then again in a diferent order... but, before I try this, I wanted to ask you if this is already possible...
THANK YOU !!!!