mankindsoftware/angular-isotope

add new item to beginning of list

Opened this issue · 1 comments

Hi there. I have added an item to entry 0 of my array, and so it created the element in behind everthing, until I called $scope.$emit('iso-method', { name: null, params:null });
However, this places the new element at the end of the list.... thoughts? fix?

I played around with this a bit just now and found that isotope's 'reloadItems' method may be what you're looking for.

// Put new item at start of list.
$scope.$apply(s.xList.unshift(newItem));

// Reload all the items into Isotope, 
// thereby creating a new internal ordering that matches your own list
$scope.$emit('iso-method', {name:'reloadItems'});

// Verify that Isotope's internal original order matches your expectations.
$scope.$emit('iso-option', {sortBy:'original-order'});