Skip to content

Instantly share code, notes, and snippets.

@bluvertigo
Last active September 8, 2017 13:35
Show Gist options
  • Select an option

  • Save bluvertigo/0fb5edd4ee9eed4320ca0779c4be4d77 to your computer and use it in GitHub Desktop.

Select an option

Save bluvertigo/0fb5edd4ee9eed4320ca0779c4be4d77 to your computer and use it in GitHub Desktop.
Sort array by name and order
objArray.sort(function(a, b) {
var textA = a.DepartmentName.toUpperCase();
var textB = b.DepartmentName.toUpperCase();
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
});
arr.sort(function(a, b) {
return parseFloat(a.order) - parseFloat(b.order);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment