The filenames are in the format "somealphatext nnnnn_xxx", where I want to sort by "xxx".
function OnInit(initData){
initData.name = "PnNumber";
initData.desc = "Add a sortable column for pn number";
initData.copyright = "myarmor";
initData.version = "1.0";
initData.default_enable = false;
var col = initData.AddColumn();
col.name = "Number";
col.method = "OnNumber";
col.label = "Number";
col.justify = "left";
col.autogroup = false;
col.autorefresh=true;
}
// Implement the OnNumber column
function OnNumber(scriptColData){
if (scriptColData.col!="Number") return;
if (scriptColData.item.is_dir) {
scriptColData.value = "";
scriptColData.sort = 3;
} else{
var re=/^\w+ \d+[_-](\d+)/i;
if (re.exec(scriptColData.item.name)){
scriptColData.value = RegExp.$1;
} else{
scriptColData.value = "No Number";
}
}
}
Save the script with a .js extension into the addins folder.
Use at your own risk and whatnot, but feel free to adapt.