How to change the order of queried checkbox options?

When I query checkbox options from a parent page structure, they are displayed correctly.
If I now change the order in the parent, the labels on the children’s page are sorted correctly. But the checkboxes remain in the “old” order. I.e. other values are selected.
What am I doing wrong?

Child:

Title: Product

fields:
  categories:
    label: Suggested Applications
    type: checkboxes
    options:
      type: query
      query: page.parent.values.toStructure
      text: "{{ item.name }}"

Parent:

Title: Products

sections:
  projects:
    type: pages
    create: project

  content:
    type: fields
    fields:
      values:
        label: Product Group Values
        type: structure
        fields:
          Name:
            label: Name
            type: text

The field stores the selected values in the order in which they were selected/sorted. So changing the order in the parent has no effect on the sorting order of the values in the child pages.

1 Like

Indeed! Too bad. I thought I had found a simple solution.

I would only have to store categories in the parent, which can be selected in all the children. I would like to have to define the options only once and only check them in the children. True/false would be visible in the frontend.

What would be the correct way here?

But what is the problem, you can still sort them in the frontend if need be?

Your solution would be to disable the manual sorting?

No, what I meant is:

  1. You sort the items inside the structure manually any way you want
  2. You select from these items in the subpage in the categories field, the order here is not important
  3. When rendering the categories in your template, you sort them by the order they have in the structure field.

I don’t think that would help. When a user sets his checkbox for a condition, he relies on the label and not a position that he cannot see. So the problem is not the rendering in the Frontend, but the input in the panel.

Please excuse my lack of understanding. Probably it’s just not the right approach.

So you are storing the number instead of the name in the content? Then it cannot possibly work, that’s right. You must set the name as value.

Okay, that wasn’t very smart of me. Sorry. It would be so easy.

Explanation: I somehow suspected the error with in the parent and not with the individual products.

Thanks for the help.

This did the trick

Title: Product

fields:
  categories:
    label: Suggested Applications
    type: checkboxes
    options:
      type: query
      query: page.parent.values.toStructure
      text: "{{ item.name }}"
      value: "{{ item.name.slug }}"