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:
parent
e4acca2951
commit
7ac52d4d9f
@ -46,6 +46,7 @@
|
|||||||
location_detail: true,
|
location_detail: true,
|
||||||
part_detail: true,
|
part_detail: true,
|
||||||
},
|
},
|
||||||
|
groupByField: 'location',
|
||||||
buttons: [
|
buttons: [
|
||||||
'#stock-options',
|
'#stock-options',
|
||||||
],
|
],
|
||||||
|
@ -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];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user