Frontmatter
| id | 6651 |
| title | button.Base: onClick() => bind handler if string |
| state | Closed |
| labels | enhancement |
| assignees | [] |
| createdAt | Apr 15, 2025, 4:32 PM |
| updatedAt | Apr 15, 2025, 9:39 PM |
| githubUrl | https://github.com/neomjs/neo/issues/6651 |
| author | tobiu |
| commentsCount | 2 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Apr 15, 2025, 9:29 PM |
button.Base: onClick() => bind handler if string

@tobiu https://github.com/neomjs/neo/blob/a32abb086068ef9caf0b0a2a502889b6c47f6d94/src/button/Base.mjs#L502
If me.handler is undefined, e.g.: neo/examples/stateProvider/table click to sort the Firstname column, this yields error message:
Uncaught TypeError: me.handler is not a function
at Button.onClick (Base.mjs:503:12)
changing:me.handler(data);
to:me.handler && me.handler(data);
makes that error message go away.
The neo/examples/table/nestedRecordfields app shows the same behavior, and also, for clicks to the Edit buttons, invokes a handler that does exist.

Good catch George,
handlers need to stay optional. This only affects the dev branch => for the next release I need to adjust listeners & domListeners in a similar get driven way.
I will create a follow-up ticket for header buttons using onClick() directly.
util.Function: resolveCallback()needs to honor view controllerscore.Observableneeds a newbindCallback()method