I understand, but I posted the fix as well and just thought you wanted to see it.
To fix the bug, in pqgrid.dev.js change line 27640 to:
var top = this.topArr ? this.topArr[ri] : 0,
I think I found the issue, it wasn't my directly created grids, it is a filter grid, and sometimes the dropdown filter has no options, in which case my column was hidden. It is a combination of these with no headings in the filter grid that caused this.topArr to be undefined. The culprit column is below (global_data["dates"] can be empty or an array of ISO date strings).
The issue is that this.topArr is undefined when there are no options
{dataIndx:"dates", width:"7%", hidden:true, title:"Dates", sortable:"true", align:"right", halign:"center", editable:false,
format: function(c) { return empty(c) ? "∞" : moment(c).format("L");}, // This changes the selector
render: function(ui){ // This changes the cell
var dates = typeof(ui.rowData["dates"])==="string" ? JSON.parse(ui.rowData["dates"]) : false,
tot_qty = 0,
filter = ui.column.filter.crules[0].value;
if(dates)
$.each(dates, function(dt, qty){
if(empty(filter) || (Array.isArray(filter) && filter.includes(dt)))
tot_qty += floatval(qty);
});
return {
text: tot_qty+"" // Must be a string
};
},
filter: {
crules: [{condition: 'range'}],
gridOptions: {
stripeRows: false,
filterModel: {header: false}, //hide search box in the dropdown
refresh: function(event, ui){
// Make the grid width not as wide
this.element.parent().width(120);
}
},
//override range compare.
conditions: {
range: {
compare: function (cellData, val) {
var dates = typeof(cellData)==="string" ? JSON.parse(cellData) : false,
is_match = false;
$.each(val, function(i,v){
if(dates && typeof(dates[v])!=="undefined")
{
is_match = true;
return false;
}
});
return is_match;
}
}
}
},
filterFn: function(ui){
// Add all the date options
var options = [];
if(!empty(global_data["dates"]) && Array.isArray(global_data["dates"]))
{
global_data["dates"].map(function(val){
var opt = {};
opt[val] = empty(val) ? "∞" : moment(val).format("L");
options.push(opt);
});
}
return {
"options": options
};
}
},