sort order

This commit is contained in:
Matthew Dillon 2015-06-18 10:33:21 -08:00
parent 84cf7817bb
commit 0a73b347f9
12 changed files with 35 additions and 15 deletions

View file

@ -8,5 +8,6 @@ export default DS.Model.extend({
deletedAt: DS.attr('date'),
createdBy: DS.attr('number'),
updatedBy: DS.attr('number'),
deletedBy: DS.attr('number')
deletedBy: DS.attr('number'),
sortOrder: DS.attr('number'),
});

View file

@ -10,5 +10,6 @@ export default DS.Model.extend({
deletedAt : DS.attr('date'),
createdBy : DS.attr('number'),
updatedBy : DS.attr('number'),
deletedBy : DS.attr('number')
deletedBy : DS.attr('number'),
sortOrder : DS.attr('number'),
});

View file

@ -15,6 +15,7 @@ export default DS.Model.extend({
createdBy : DS.attr('number'),
updatedBy : DS.attr('number'),
deletedBy : DS.attr('number'),
sortOrder : DS.attr('number'),
speciesNameMU: function() {
return Ember.String.htmlSafe(`<em>${this.get('speciesName')}</em>`);

View file

@ -17,6 +17,7 @@ export default DS.Model.extend({
updatedBy : DS.attr('number'),
deletedBy : DS.attr('number'),
totalMeasurements: DS.attr('number'),
sortOrder : DS.attr('number'),
strainNameMU: function() {
let type = this.get('typeStrain') ? '<sup>T</sup>' : '';

View file

@ -16,6 +16,6 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
controller.set('model', models.characteristics);
controller.set('tableAttrs', tableAttrs);
controller.set('row', 'characteristic-index-row');
controller.set('sort', ['characteristicName']);
controller.set('sort', ['characteristicType.characteristicTypeName', 'sortOrder']);
},
});

View file

@ -23,10 +23,10 @@ export default Ember.Component.extend({
models[item.model] = models[item.model].filter((i) => {
if (!Ember.isEmpty(i.get(item.children))) { return true; }
});
models[item.model] = models[item.model].sortBy(item.text);
models[item.model] = models[item.model].sortBy('sortOrder');
let temp = models[item.model].map((data) => {
let temp_children = [];
let sorted_children = data.get(item.children).sortBy(item.ctext);
let sorted_children = data.get(item.children).sortBy('sortOrder');
sorted_children.forEach((child) => {
temp_children.push({id: child.get(item.cid), text: child.get(item.ctext)});
});

View file

@ -13,6 +13,6 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
controller.set('model', model);
controller.set('tableAttrs', tableAttrs);
controller.set('row', 'species-index-row');
controller.set('sort', ['speciesName']);
controller.set('sort', ['sortOrder']);
},
});

View file

@ -13,6 +13,6 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
controller.set('model', model);
controller.set('tableAttrs', tableAttrs);
controller.set('row', 'strain-index-row');
controller.set('sort', ['fullNameMU']);
controller.set('sort', ['sortOrder']);
},
});

View file

@ -12,7 +12,8 @@ module.exports = function(app) {
deletedAt: null,
createdBy: 1,
updatedBy: 1,
deletedBy: null
deletedBy: null,
sortOrder: 1,
},
{
id: 2,
@ -23,7 +24,8 @@ module.exports = function(app) {
deletedAt: null,
createdBy: 1,
updatedBy: 1,
deletedBy: null
deletedBy: null,
sortOrder: 2,
},
{
id: 3,
@ -34,7 +36,8 @@ module.exports = function(app) {
deletedAt: null,
createdBy: 1,
updatedBy: 1,
deletedBy: null
deletedBy: null,
sortOrder: 3,
},
]

View file

@ -14,7 +14,8 @@ module.exports = function(app) {
deletedAt: null,
createdBy: 1,
updatedBy: 1,
deletedBy: null
deletedBy: null,
sortOrder: 1,
},
{
id: 2,
@ -27,7 +28,8 @@ module.exports = function(app) {
deletedAt: null,
createdBy: 1,
updatedBy: 1,
deletedBy: null
deletedBy: null,
sortOrder: 2,
},
{
id: 3,
@ -40,7 +42,8 @@ module.exports = function(app) {
deletedAt: null,
createdBy: 1,
updatedBy: 1,
deletedBy: null
deletedBy: null,
sortOrder: 3,
},
{
id: 4,
@ -53,7 +56,8 @@ module.exports = function(app) {
deletedAt: null,
createdBy: 1,
updatedBy: 1,
deletedBy: null
deletedBy: null,
sortOrder: 4,
},
{
id: 5,
@ -66,7 +70,8 @@ module.exports = function(app) {
deletedAt: null,
createdBy: 1,
updatedBy: 1,
deletedBy: null
deletedBy: null,
sortOrder: 5,
}
]

View file

@ -17,6 +17,7 @@ module.exports = function(app) {
createdBy: 1,
updatedBy: 1,
deletedBy: null,
sortOrder: 1,
},
{
id: 2,
@ -32,6 +33,7 @@ module.exports = function(app) {
createdBy: 1,
updatedBy: 1,
deletedBy: null,
sortOrder: 2,
},
{
id: 3,
@ -47,6 +49,7 @@ module.exports = function(app) {
createdBy: 1,
updatedBy: 1,
deletedBy: null,
sortOrder: 3,
},
{
id: 4,
@ -62,6 +65,7 @@ module.exports = function(app) {
createdBy: 1,
updatedBy: 1,
deletedBy: null,
sortOrder: 4,
}
];

View file

@ -20,6 +20,7 @@ module.exports = function(app) {
deletedBy: null,
totalMeasurements: 5,
notes: "Test notes",
sortOrder: 1,
},
{
id: 2,
@ -38,6 +39,7 @@ module.exports = function(app) {
deletedBy: null,
totalMeasurements: 5,
notes: "Test notes",
sortOrder: 2,
},
{
id: 3,
@ -56,6 +58,7 @@ module.exports = function(app) {
deletedBy: null,
totalMeasurements: 0,
notes: "Test notes",
sortOrder: 3,
},
{
id: 4,
@ -74,6 +77,7 @@ module.exports = function(app) {
deletedBy: null,
totalMeasurements: 0,
notes: "Test notes",
sortOrder: 4.
}
];