Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort plugin evaluates insert index regardless of change #1722

Closed
akagomez opened this issue May 28, 2015 · 0 comments
Closed

Sort plugin evaluates insert index regardless of change #1722

akagomez opened this issue May 28, 2015 · 0 comments

Comments

@akagomez
Copy link
Contributor

var list = new can.List([
  { firstName: 'Chris', lastName: 'Gomez' },
  { firstName: 'Justin', lastName: 'Meyer' }
]);

list.attr('comparator', 'firstName'); 
list.attr('0.lastName', 'First'); // _getInsertIndex is called needlessly

list.attr('comparator', function (a, b) {
  a = a.attr('firstName');
  b = b.attr('firstName');
  return a === b ? 0 : a > b ? -1 : 1; // Desc
}); 
list.attr('1.lastName', 'Last'); // _getInsertIndex is called needlessly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant