Frontmatter
| id | 3799 |
| title | Container needs a getReference() method |
| state | Closed |
| labels | enhancement |
| assignees | [] |
| createdAt | Jan 6, 2023, 2:21 AM |
| updatedAt | Jan 6, 2023, 8:56 AM |
| githubUrl | https://github.com/neomjs/neo/issues/3799 |
| author | maxrahder |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 6, 2023, 8:56 AM |
Container needs a getReference() method

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
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.