LearnNewsExamplesServices
Frontmatter
id7115
titleNeo.selection.Model: add getController()
stateClosed
labels
enhancement
assignees[]
createdAtJul 27, 2025, 2:22 AM
updatedAtOct 23, 2025, 12:58 AM
githubUrlhttps://github.com/neomjs/neo/issues/7115
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJul 27, 2025, 2:24 AM

Neo.selection.Model: add getController()

Closed v10.1.0 enhancement
tobiu
tobiu commented on Jul 27, 2025, 2:22 AM

Use case are selectionModel based listeners, which should get mapped to view controllers:

{
    module: ComponentTreeList,
    header: {
        text: 'Components'
    },
    selectionModel: {
        listeners: {
            selectionChange: 'onComponentTreeListSelectionChange'
        }
    }
}

this leads to util.Function:

export function resolveCallback(fn, scope=this) {
    if (Neo.isString(fn)) {
        if (!scope[fn] && fn.startsWith('up.')) {
            fn = fn.slice(3);
            while (!scope[fn] && (scope = scope.parent));
        } else {
            scope = scope.getController?.()?.getHandlerScope(fn, null) || scope
        }

        fn = scope[fn]
    }

    return {fn, scope}
}

the SM must try to pass a matching view controller.

@gplanansky

tobiu added the enhancement label on Jul 27, 2025, 2:22 AM
tobiu referenced in commit d5dec95 - "Neo.selection.Model: add getController() #7115" on Jul 27, 2025, 2:24 AM
tobiu closed this issue on Jul 27, 2025, 2:24 AM