Sorting treetable top level by several parameters and sublevels just by one?

Hi!

I’ve a treetable in which the top level has several types of items, for instance, folders of devices, folders of docs, and one miscellaneous folder. At first, I want to place miscellaneous folder always on top, then sort devices folder by string, and finally docs folders also by string.

The objects of elements looks like this:

{
  id: ,
  type: misc,
  value: 'Other data',
}

{
  id: ,
  type: 'dev',
  value: 'PIR sensors',
}

{
  id: ,
  type: 'docs',
  value: 'Mounting manuals',
}

But on sublevels I just want to sort by string without any special logic.

Thaks in advance.