sort collabs by id

This commit is contained in:
Claudio Barril 2015-04-11 16:09:55 -03:00
parent 3ad7a345cc
commit 13b3c307c7
2 changed files with 7 additions and 1 deletions

View File

@ -37,10 +37,12 @@ import javax.xml.bind.annotation.XmlRootElement;
isGetterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY) isGetterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY)
public class RestCollaboration { public class RestCollaboration {
private long id;
private String email; private String email;
private String role; private String role;
public RestCollaboration(@NotNull Collaboration collaboration) { public RestCollaboration(@NotNull Collaboration collaboration) {
this.id = collaboration.getId();
this.email = collaboration.getCollaborator().getEmail(); this.email = collaboration.getCollaborator().getEmail();
this.role = collaboration.getRole().getLabel(); this.role = collaboration.getRole().getLabel();
} }
@ -59,6 +61,10 @@ public class RestCollaboration {
} }
public long getId() {
return id;
}
public String getRole() { public String getRole() {
return role; return role;
} }

View File

@ -192,7 +192,7 @@ $(function () {
success:function (data, textStatus, jqXHR) { success:function (data, textStatus, jqXHR) {
// Owner roles is the first in the table ... // Owner roles is the first in the table ...
var collabs = data.collaborations.sort(function (a, b) { var collabs = data.collaborations.sort(function (a, b) {
return a.role <= b.role; return a.id > b.id;
}); });
// Add all the columns in the table ... // Add all the columns in the table ...