sort order
This commit is contained in:
parent
84cf7817bb
commit
0a73b347f9
12 changed files with 35 additions and 15 deletions
|
@ -8,5 +8,6 @@ export default DS.Model.extend({
|
||||||
deletedAt: DS.attr('date'),
|
deletedAt: DS.attr('date'),
|
||||||
createdBy: DS.attr('number'),
|
createdBy: DS.attr('number'),
|
||||||
updatedBy: DS.attr('number'),
|
updatedBy: DS.attr('number'),
|
||||||
deletedBy: DS.attr('number')
|
deletedBy: DS.attr('number'),
|
||||||
|
sortOrder: DS.attr('number'),
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,5 +10,6 @@ export default DS.Model.extend({
|
||||||
deletedAt : DS.attr('date'),
|
deletedAt : DS.attr('date'),
|
||||||
createdBy : DS.attr('number'),
|
createdBy : DS.attr('number'),
|
||||||
updatedBy : DS.attr('number'),
|
updatedBy : DS.attr('number'),
|
||||||
deletedBy : DS.attr('number')
|
deletedBy : DS.attr('number'),
|
||||||
|
sortOrder : DS.attr('number'),
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,6 +15,7 @@ export default DS.Model.extend({
|
||||||
createdBy : DS.attr('number'),
|
createdBy : DS.attr('number'),
|
||||||
updatedBy : DS.attr('number'),
|
updatedBy : DS.attr('number'),
|
||||||
deletedBy : DS.attr('number'),
|
deletedBy : DS.attr('number'),
|
||||||
|
sortOrder : DS.attr('number'),
|
||||||
|
|
||||||
speciesNameMU: function() {
|
speciesNameMU: function() {
|
||||||
return Ember.String.htmlSafe(`<em>${this.get('speciesName')}</em>`);
|
return Ember.String.htmlSafe(`<em>${this.get('speciesName')}</em>`);
|
||||||
|
|
|
@ -17,6 +17,7 @@ export default DS.Model.extend({
|
||||||
updatedBy : DS.attr('number'),
|
updatedBy : DS.attr('number'),
|
||||||
deletedBy : DS.attr('number'),
|
deletedBy : DS.attr('number'),
|
||||||
totalMeasurements: DS.attr('number'),
|
totalMeasurements: DS.attr('number'),
|
||||||
|
sortOrder : DS.attr('number'),
|
||||||
|
|
||||||
strainNameMU: function() {
|
strainNameMU: function() {
|
||||||
let type = this.get('typeStrain') ? '<sup>T</sup>' : '';
|
let type = this.get('typeStrain') ? '<sup>T</sup>' : '';
|
||||||
|
|
|
@ -16,6 +16,6 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||||
controller.set('model', models.characteristics);
|
controller.set('model', models.characteristics);
|
||||||
controller.set('tableAttrs', tableAttrs);
|
controller.set('tableAttrs', tableAttrs);
|
||||||
controller.set('row', 'characteristic-index-row');
|
controller.set('row', 'characteristic-index-row');
|
||||||
controller.set('sort', ['characteristicName']);
|
controller.set('sort', ['characteristicType.characteristicTypeName', 'sortOrder']);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,10 +23,10 @@ export default Ember.Component.extend({
|
||||||
models[item.model] = models[item.model].filter((i) => {
|
models[item.model] = models[item.model].filter((i) => {
|
||||||
if (!Ember.isEmpty(i.get(item.children))) { return true; }
|
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 = models[item.model].map((data) => {
|
||||||
let temp_children = [];
|
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) => {
|
sorted_children.forEach((child) => {
|
||||||
temp_children.push({id: child.get(item.cid), text: child.get(item.ctext)});
|
temp_children.push({id: child.get(item.cid), text: child.get(item.ctext)});
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,6 +13,6 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||||
controller.set('model', model);
|
controller.set('model', model);
|
||||||
controller.set('tableAttrs', tableAttrs);
|
controller.set('tableAttrs', tableAttrs);
|
||||||
controller.set('row', 'species-index-row');
|
controller.set('row', 'species-index-row');
|
||||||
controller.set('sort', ['speciesName']);
|
controller.set('sort', ['sortOrder']);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,6 +13,6 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||||
controller.set('model', model);
|
controller.set('model', model);
|
||||||
controller.set('tableAttrs', tableAttrs);
|
controller.set('tableAttrs', tableAttrs);
|
||||||
controller.set('row', 'strain-index-row');
|
controller.set('row', 'strain-index-row');
|
||||||
controller.set('sort', ['fullNameMU']);
|
controller.set('sort', ['sortOrder']);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,7 +12,8 @@ module.exports = function(app) {
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
createdBy: 1,
|
createdBy: 1,
|
||||||
updatedBy: 1,
|
updatedBy: 1,
|
||||||
deletedBy: null
|
deletedBy: null,
|
||||||
|
sortOrder: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
|
@ -23,7 +24,8 @@ module.exports = function(app) {
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
createdBy: 1,
|
createdBy: 1,
|
||||||
updatedBy: 1,
|
updatedBy: 1,
|
||||||
deletedBy: null
|
deletedBy: null,
|
||||||
|
sortOrder: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
|
@ -34,7 +36,8 @@ module.exports = function(app) {
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
createdBy: 1,
|
createdBy: 1,
|
||||||
updatedBy: 1,
|
updatedBy: 1,
|
||||||
deletedBy: null
|
deletedBy: null,
|
||||||
|
sortOrder: 3,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,8 @@ module.exports = function(app) {
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
createdBy: 1,
|
createdBy: 1,
|
||||||
updatedBy: 1,
|
updatedBy: 1,
|
||||||
deletedBy: null
|
deletedBy: null,
|
||||||
|
sortOrder: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
|
@ -27,7 +28,8 @@ module.exports = function(app) {
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
createdBy: 1,
|
createdBy: 1,
|
||||||
updatedBy: 1,
|
updatedBy: 1,
|
||||||
deletedBy: null
|
deletedBy: null,
|
||||||
|
sortOrder: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
|
@ -40,7 +42,8 @@ module.exports = function(app) {
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
createdBy: 1,
|
createdBy: 1,
|
||||||
updatedBy: 1,
|
updatedBy: 1,
|
||||||
deletedBy: null
|
deletedBy: null,
|
||||||
|
sortOrder: 3,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
|
@ -53,7 +56,8 @@ module.exports = function(app) {
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
createdBy: 1,
|
createdBy: 1,
|
||||||
updatedBy: 1,
|
updatedBy: 1,
|
||||||
deletedBy: null
|
deletedBy: null,
|
||||||
|
sortOrder: 4,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 5,
|
id: 5,
|
||||||
|
@ -66,7 +70,8 @@ module.exports = function(app) {
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
createdBy: 1,
|
createdBy: 1,
|
||||||
updatedBy: 1,
|
updatedBy: 1,
|
||||||
deletedBy: null
|
deletedBy: null,
|
||||||
|
sortOrder: 5,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ module.exports = function(app) {
|
||||||
createdBy: 1,
|
createdBy: 1,
|
||||||
updatedBy: 1,
|
updatedBy: 1,
|
||||||
deletedBy: null,
|
deletedBy: null,
|
||||||
|
sortOrder: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
|
@ -32,6 +33,7 @@ module.exports = function(app) {
|
||||||
createdBy: 1,
|
createdBy: 1,
|
||||||
updatedBy: 1,
|
updatedBy: 1,
|
||||||
deletedBy: null,
|
deletedBy: null,
|
||||||
|
sortOrder: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
|
@ -47,6 +49,7 @@ module.exports = function(app) {
|
||||||
createdBy: 1,
|
createdBy: 1,
|
||||||
updatedBy: 1,
|
updatedBy: 1,
|
||||||
deletedBy: null,
|
deletedBy: null,
|
||||||
|
sortOrder: 3,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
|
@ -62,6 +65,7 @@ module.exports = function(app) {
|
||||||
createdBy: 1,
|
createdBy: 1,
|
||||||
updatedBy: 1,
|
updatedBy: 1,
|
||||||
deletedBy: null,
|
deletedBy: null,
|
||||||
|
sortOrder: 4,
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ module.exports = function(app) {
|
||||||
deletedBy: null,
|
deletedBy: null,
|
||||||
totalMeasurements: 5,
|
totalMeasurements: 5,
|
||||||
notes: "Test notes",
|
notes: "Test notes",
|
||||||
|
sortOrder: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
|
@ -38,6 +39,7 @@ module.exports = function(app) {
|
||||||
deletedBy: null,
|
deletedBy: null,
|
||||||
totalMeasurements: 5,
|
totalMeasurements: 5,
|
||||||
notes: "Test notes",
|
notes: "Test notes",
|
||||||
|
sortOrder: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
|
@ -56,6 +58,7 @@ module.exports = function(app) {
|
||||||
deletedBy: null,
|
deletedBy: null,
|
||||||
totalMeasurements: 0,
|
totalMeasurements: 0,
|
||||||
notes: "Test notes",
|
notes: "Test notes",
|
||||||
|
sortOrder: 3,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
|
@ -74,6 +77,7 @@ module.exports = function(app) {
|
||||||
deletedBy: null,
|
deletedBy: null,
|
||||||
totalMeasurements: 0,
|
totalMeasurements: 0,
|
||||||
notes: "Test notes",
|
notes: "Test notes",
|
||||||
|
sortOrder: 4.
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Reference in a new issue