LearnNewsExamplesServices
Frontmatter
id3799
titleContainer needs a getReference() method
stateClosed
labels
enhancement
assignees[]
createdAtJan 6, 2023, 2:21 AM
updatedAtJan 6, 2023, 8:56 AM
githubUrlhttps://github.com/neomjs/neo/issues/3799
authormaxrahder
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 6, 2023, 8:56 AM

Container needs a getReference() method

Closed v8.1.0 enhancement
maxrahder
maxrahder commented on Jan 6, 2023, 2:21 AM

Simple container views may not need a controller, and may still need to get references to child items. For consistency, the component should be able to look up components via their "reference" just like their controller can.

There is a this.down({}) method, but strangely, that doesn't work for child items that have a "refence" config. This.down using the "reference" property should also work.

maxrahder added the enhancement label on Jan 6, 2023, 2:21 AM
tobiu
tobiu Jan 6, 2023, 8:56 AM

hi max,

make sure you don't have any typos in there (you wrote "refence"). it definitely does work, otherwise references would not.

https://github.com/neomjs/neo/blob/dev/src/controller/Component.mjs#L116

    getReference(name) {
        let me        = this,
            component = me.references[name];

    if (!component) {
        component = me.component.down({reference: name});

        if (component) {
            me.references[name] = component;
        }
    }

    return component || null;
}

closing the ticket. if you find a breaking use case, we can re-open it :)

tobiu closed this issue on Jan 6, 2023, 8:56 AM