I am looking for a solution to get multidimensional arrays naturally sorted with JavaScript. I found some solutions sorting multidimensional arrays or sorting naturally, but I found no solution for both requirements.
I also cannot combine the solutions. here is what the array looks like:
var content = [
{0: 'somename', 1: '10.1.1.100', 2: 'aa-bb-cc-dd-ee-ff'},
{0: 'someothername', 1: '10.1.1.12', 2: '11-22-33-44-55-66'}
];
As you can see the array contains servernames, IP addresses and MAC addresses. It is some table content written in this array. To sort the table I want to sort this array.
Do you have any clever idea how to handle this?
Thank you for your help.
edit: OK maybe, I have to be more specific: There is no problem to sort a multidimensional array. I am able to sort this array for MAC, IP or name. It is a simple one line code. The problem is to sort them naturally. Whene you have alphanumerical strings like server name or IP you want to sort the example list:
{a3, a12, a100, a1}
like this:
{a1, a3, a12, a100}
This is called natural sorting. The "normal" sorting instead looks like this:
{a1, a100, a12, a3}
I found several algos for sorting naturally but I was not able to prepare them to sort a multidimenional array.