I am currently using version 8.3.0.
I am using the max function for a column that is dataType: 'date' and a groupModel that results in some groups with a single row. In those groups the max date is not displayed in the group summary for that group.
I investigated and found that the max function initializes the max variable using the arr[0] element. It then compares that in the while loop with valDate which in this case is also the arr[0] element value. Because valDate is not greater than max the val variable remains undefined. The max variable is assigned the val value after the while loop exits so the returned max value is undefined.
Note: max would also probably be undefined in a multi-row group when the arr[0] element happens to be the maximum date.
The code for the max function starts on line 14928 in pqgrid.dev.js and is shown below:
max: function(arr, column) {
var len, max, temp, val, valDate, dataType = pq.getDataType(column);
arr = this.flatten(arr);
len = arr.length;
if (len) {
if (dataType == "number") {
max = arr[0] * 1;
while (len--) {
temp = arr[len];
max = temp > max || isNaN(max) ? temp : max
}
} else if (dataType == "date") {
max = Date.parse(arr[0]);
while (len--) {
valDate = Date.parse(arr[len]);
if (valDate > max || isNaN(max)) {
max = valDate;
val = arr[len]
}
}
max = val
} else {
arr.sort();
max = arr[len - 1]
}
return max
}
},