Tailor model - nested category display

I have a tailor model Events (stream) and Events Categories (structure). Events categories is maxDepth: 2. The relation is Event hasOne Category.
How can I display in the Event form at backed the category relation (maxItem=1) in a nested tree format?
I have in the Event.yaml like below and tried already :

category:
        tab: Config
        label: Category
        type: entries
        source: Events\Category
        maxItems: 1

tried below, but it returns error: “Tailor\Models\StreamRecord” has no relation “category”.

category:
        tab: Config
        label: Category
        type: relation
        source: Events\Category
        displayMode: dropdown
        showTree: true
        maxItems: 1

Any idea?

Hey @syl-via

The entries field in Tailor supports nested tree display, but you need to use displayMode: controller. This is the only display mode that supports the tree structure for hierarchical content like your categories.

Here’s the correct configuration:

category:
    tab: Config
    label: Category
    type: entries
    source: Events\Category
    maxItems: 1
    displayMode: controller

The displayMode: controller option will automatically detect that your Events\Category is a structure blueprint and enable the tree view in the picker popup.

The controller display mode is specifically designed for this use case and will respect your maxDepth: 2 setting from the category blueprint.

Thanks @daftspunk for the reply. I have tried this after tailor:refresh and cache:clear and something is not working. I am using OctoberCMS 4. To test it, I have updated he build-in Blog blueprints. I set Blog/Category to maxDepth=2 and then in the Blog/Post applied your suggestions. Created a nested Categories, but the Post adding form is not showing it properly.

Here is the config:

Here is the Post form:

It’s weird. Could it be the OctoberCMS v.4 issue?