2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-30 04:26:44 +00:00

Optionally select which column gets grouped

- Allow grouping by numerical values
This commit is contained in:
Oliver Walters 2019-05-28 19:12:10 +10:00
parent e4acca2951
commit 7ac52d4d9f
3 changed files with 5 additions and 5 deletions

View File

@ -46,6 +46,7 @@
location_detail: true, location_detail: true,
part_detail: true, part_detail: true,
}, },
groupByField: 'location',
buttons: [ buttons: [
'#stock-options', '#stock-options',
], ],

View File

@ -72,9 +72,9 @@
if (this.options.groupBy && this.options.groupByField !== '') { if (this.options.groupBy && this.options.groupByField !== '') {
if (1 || (this.options.sortName != this.options.groupByField)) { if (this.options.sortName != this.options.groupByField) {
this.data.sort(function (a, b) { this.data.sort(function (a, b) {
return a[that.options.groupByField].localeCompare(b[that.options.groupByField]); return a[that.options.groupByField] == b[that.options.groupByField];
}); });
} }

View File

@ -385,8 +385,7 @@ function loadStockTable(table, options) {
pageSize: 25, pageSize: 25,
rememberOrder: true, rememberOrder: true,
groupBy: true, groupBy: true,
groupByField: 'part_name', groupByField: options.groupByField || 'part',
groupByFields: ['part_name', 'test'],
groupByFormatter: function(field, id, data) { groupByFormatter: function(field, id, data) {
if (field == 'Part') { if (field == 'Part') {
@ -404,7 +403,7 @@ function loadStockTable(table, options) {
stock += item.quantity; stock += item.quantity;
}); });
return stock + ' <i>(' + data.length + ' items)</i>'; return stock;
} else if (field == 'Location') { } else if (field == 'Location') {
/* Determine how many locations */ /* Determine how many locations */
var locations = []; var locations = [];