sort file in fileview tag

This commit is contained in:
lxsang 2021-01-02 13:35:56 +01:00
parent f3f3559393
commit 5b6e6f8d94
2 changed files with 24 additions and 0 deletions

Binary file not shown.

View File

@ -265,6 +265,30 @@ namespace OS {
if (!data) {
return;
}
// sort file by type, then by name
data
.sort(function(a:API.FileInfoType,b:API.FileInfoType): number{
if(a.filename)
{
a.name = a.filename;
}
if(b.filename)
{
b.name = b.filename;
}
return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
})
.sort(function(a:API.FileInfoType,b:API.FileInfoType): number{
if(!a.type)
{
a.type = "none";
}
if(!b.type)
{
b.type = "none";
}
return a.type.toLowerCase().localeCompare(b.type.toLowerCase());
});
this.data = data;
if (this.status) {
(this.refs.status as LabelTag).text = " ";