In this example for Multi-dimensional sorting it uses this first column as the sort column
var shapes = [
[5, "Pentagon"],
[3, "Triangle"],
[8, "Octagon"],
[4, "Rectangle"]
];
shapes.sort(function(a, b)
{
return a[0] - b[0];
});
I would like to edit this anonymous function so I could pass the column ordinal I want to sort on, otherwise I'm going to have to have different sort function for each column and it is going to get very messy very quickly. I've googled around but can find nothing suitable.
As a rough guess I no it does not work, but this is what I want:
shapes.sort(function(a, b, COL)
{
return a[COL] - b[COL];
});
Where COL is new passed param. Thanks!