Feature Request: Configurable Sorting for oh-repeater

Component: oh-repeater

Description:

The oh-repeater should support configurable sorting when using sourceType: itemsInGroup.

Currently, items are sorted alphabetically by ItemName by default. It would be useful to have an additional option to preserve the original definition order of items.

Proposed configuration:

yaml

- component: oh-repeater
  config:
    for: item
    sourceType: itemsInGroup
    groupItem: gPV
    sortBy: definition
  slots:
    default:
      - component: oh-label-item
        config:
          item: =loop.item.name
          title: =loop.item.label

Requested sorting options:

  • name: Alphabetical sorting by ItemName (current behavior).
  • definition: Preserve the order in which items are defined in the openHAB item configuration.

Goal:

Provide more control over the display order of items in MainUI, especially for groups where items have been deliberately defined in a specific order.

The current default sorting behavior should remain unchanged for backward compatibility.

This can already be achieved by using:

fetchMetadata: widgetOrder

If the widgetOrder is set in MainUI, it will be used for sorting.
As an example, you can check the floors menu in semanticHomeMenu.

Thanks! Regarding a related issue, I was just about to give up and look for a JS-based solution when @hr3’s post appeared … immediately I’ve given it a like.

Lets say that it wasn’t easy to find the right way to achieve what one wants…

This is everything the documentation says about fetchMetadata:

image

Really hard to understand to me :sweat_smile:

Following your suggestion, I looked for the metadata:

where the “alexa” example is like a ray of light in the darkness.:joy:

In the end, this is what I added to the item channels:

image

And it works for me. Still, I agree with the author of the post: default automate sorting even by position could be an idea. And, ideally, it should be documented. :wink:

Thank you