angular-isotope icon indicating copy to clipboard operation
angular-isotope copied to clipboard

add new item to beginning of list

Open ghost opened this issue 11 years ago • 1 comments
trafficstars

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?

ghost avatar May 02 '14 17:05 ghost

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'});

mankindsoftware avatar May 02 '14 19:05 mankindsoftware