Manual sort

Ah, yes, true. Then the custom column makes more sense. Here's a quick solution. Simply change sortValue in the script until the drives are in the order you like.

function OnInit(initData) {
    initData.name = 'CustomDriveSort';
    initData.version = '2022-04-21';
    initData.copyright = '';
    initData.url = 'https://resource.dopus.com/t/manual-sort/41093';
    initData.desc = 'Custom Drive Number for manual sorting';
    initData.default_enable = true;
    initData.min_version = '12.0';
}

function OnAddColumns(addColData) {
    var col = addColData.AddColumn();
    col.name = 'CustomDriveSort';
    col.header = 'CDS';
    col.method = 'OnColumn';
}

function OnColumn(scriptColData) {
    var itemDrive = scriptColData.item.path.drive;
    var sortValue;

    if (itemDrive == 0) {
        sortValue = 100;
    } else if (itemDrive == 1) {
        sortValue = 101;
    } else if (itemDrive == 2) {
        sortValue = 102;
    } else if (itemDrive == 3) {
        sortValue = 103;
    } else if (itemDrive == 4) {
        sortValue = 104;
    } else if (itemDrive == 5) {
        sortValue = 105;
    } else if (itemDrive == 6) {
        sortValue = 106;
    } else if (itemDrive == 7) {
        sortValue = 108;
    } else if (itemDrive == 8) {
        sortValue = 108;
    } else if (itemDrive == 9) {
        sortValue = 109;
    } else if (itemDrive == 10) {
        sortValue = 110;
    } else if (itemDrive == 11) {
        sortValue = 111;
    } else if (itemDrive == 12) {
        sortValue = 112;
    } else if (itemDrive == 13) {
        sortValue = 113;
    } else if (itemDrive == 14) {
        sortValue = 114;
    } else if (itemDrive == 15) {
        sortValue = 115;
    } else sortValue = itemDrive;

    scriptColData.value = sortValue;
}

ColumnCustomDriveSort.js.txt (1.6 KB)


2 Likes