PDA

View Full Version : [FIXED] Pivot grid naturalsort fails



demongloom
28 May 2015, 10:12 AM
I'm getting exception when pivotgrid does naturalsort

For instance it fails in normChunk function from matrix.Abstract.js


normChunk = function (s, l) {
// normalize spaces; find floats not starting with '0', string or 0 if not defined (Clint Priest)
return (!s.match(ore) || l == 1) && parseFloat(s) || s.replace(snre, ' ').replace(sre, '') || 0;
};

The normChunk function is called from code presented below


// natural sorting through split numeric strings and default strings
for (var cLoc = 0, xNl = xN.length, yNl = yN.length, numS = Math.max(xNl, yNl); cLoc < numS; cLoc++) {
oFxNcL = normChunk(xN[cLoc], xNl);
oFyNcL = normChunk(yN[cLoc], yNl);

It takes two records, splits into chunks, then compare each chunk.

For example the ["aaa123", "aaa555bbb"] will be transformed into [["aaa", "123"], ["aaa", 555, "bbb"]].

Unfortunately in my case the norm chunk (normChunk(xN[cLoc], xNl);) will get undefined at position #3 and fail on !s.match(ore) because s is undefined.

ateodorescu
26 Jun 2015, 5:42 AM
Thanks for the report! I have opened a bug in our bug tracker.