NEWS
[solved] Change enums object order
-
Hi all,
I'm using the Enums entries as an array to update them with my PLC with the S7 adapter so their order is very important.
There are sometimes more than 20 objects in there, now I forgot one in the beginning but it's impossible to move or rearrange them although clearly a little hand appears when you hover over the "state" icon.
Is there a way to rearrange them using a file editor in a json file or so?
Was looking in the ioBroker folders but can't find anything...Thanks in advance!
-
@martiman sagte in Change enums object order:
Is there a way to rearrange them
I don't think so. I guess they are sorted alphabetically.
-
@homoran No not alphabetically, they are put there in order as you place them.
If you miss one in the beginning you have to delete all the ones after and start all over -
@martiman sagte in Change enums object order:
they are put there in order as you place them.
so I'm very sorry, that I cannot help you.
I just tried to play with some entries, but no success.Maybe another user who works with enums cann help.
-
It is possible to sort it, as the enums are objects.
Activate the expert mode, go to objects tab, enum and look for the object of enum group you want to edit.
Then open the object raw by clicking on the end of the line. There you will find the members array, which is what you are looking for.You can automate the sorting with a javascript, while in the settings of the javascript adapter the setObject is checked.
-
@homoran Thanks for your effort, anyway I'm doing it by hand now checking 3 times each time adding
But because of the little hand it looks like the possibility in arranging them was meant to be the plan but simply not implemented yet.
Therefore my message. -
@jey-cee that was what I remembered, but I didn't find the listing (in enums )
-
@jey-cee Awesome!!! Thanks, didn't think of expert mode was necessary to show enums in objects
-
@jey-cee sagte: You can automate the sorting with a javascript, while in the settings of the javascript adapter the setObject is checked.
const idBat = 'enum.functions.HeatingUp.BatStat'; const obj = getObject(idBat); obj.common.members.sort(); setObject(idBat, obj);
-
@homoran For me this issue can be closed, can I or does a moderator have to de this?
-
@martiman sagte in Change enums object order:
can I
edit the first post and set [solved] at the start of the title