- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
function group_sorting_ABC(array, mode)
{
var arr = [],
resArray = [],
add;
for (var i = 0; i < array.length; i++)
{
var key;
if (array[i].index && mode == 'index')
{
switch (array[i].index.toString().length)
{
case 1:
add = '00';
break;
case 2:
add = '0';
break;
case 3:
add = '';
break;
}
key = add + array[i].index;
}
else
{
key = array[i].name;
}
arr.push(key + '@' + i);
}
arr = arr.sort();
for (var i = 0; i < arr.length; i++)
{
var a = arr[i].split('@');
var item = array[a[1]];
resArray.push(item);
}
return resArray;
}
bormand 24.06.2012 18:56 # 0
wvxvw 24.06.2012 19:09 # 0
roman-kashitsyn 24.06.2012 20:05 # +1
bormand 24.06.2012 20:36 # 0
DarkThinker 24.06.2012 21:36 # 0