Order elements in Model

Hello! Here are my models:


If I put it on the widget, it looks like this:

But I need to change the order of Items. I didn`t find how can I do it.

There is no ordering in the model.

You probably mean the UI placement of widgets. That you can change in ‘Pages’.

1 Like

In the model:

Add Metadata → Default Widget Order Index

1 Like

Got it! Thanks!

I am using Default Widget Order Index Metadata on my model items.

Ordering works fine EXCEPT these items that have NULL value.
NULLED items always shows FIRST, skipping their order value.

Is this a bug ?

No technically speaking NULL is a valid state albeit a special one so you cannot order it e.g. if all items are Numbers how to sort that?
If any at all you could see it as a bug of yours as with proper config items and rules config and initialization at runtime there (ultimately) should not be NULL state items.

But Item state should have nothing to do with metadata, and how widgets use metadata. It’s just a state, doesn’t affect other properties.

I my logic, i tend to agree with @rossko57. We want to set the display ordering of some items. The ordering is about the items.
We are not ordering based on the values themselves (like in excel lets say).

I agree NULL should not be a state of an item, but we are talking about display on a home assistant screen.

Yes to some extent you do. That’s apparently how the ordering function works in case of NULL, like it or not. Did you try using the options field to map NULL to some display string ?

Display of an uninitialized hence wrong value, that is. So in terms of your “home assistant”, the bug is in your setup/rules. You can work around that in the widget and display whatever but you must not expect the default ordering function to do that for you.
The right fix is always to fix the root cause so fix the value that’ll then also fix your ordering “problem”.

But NULL (or UNDEF) are not ‘wrong’ or ‘incorrect’ states. They are a legitimate “don’t know” state. It is not always appropriate to force some made-up state where the reality is “don’t know yet”.

I cannot imagine why that would want to be taken into account in ordering widgets, but if that is the designed intent rather than accident, so be it.

That’s my point also. If its a feature, that’s ok. If it’s a bug maybe it can be addressed :slight_smile:

Case closed.

Ok i was totally wrong with my case. I rephrase my original post/comment.

“I am using Default Widget Order Index Metadata on my model items.
Ordering works fine EXCEPT these items that belong to that location as POINTS. They always show first in location.”

So, it just hit me that these NULL values were POINTS in that location.
Order index works with Equipment in that location. All points outside equipment (orphans of equipment) in that location show up first, no matter what.