primefaces: Menu : MenuItem oncomplete script is not called if no action is specified
Describe the bug
Hi !
Since the Primefaces 13 release, if you define a menu with a menuitem with an oncomplete script and you don’t define a bean action method, the oncomplete script is not called.
Reproducer
<p:menu>
<p:menuitem value="Without action" oncomplete="console.log('Oncomplete not called')" />
<p:menuitem value="With action" action="#{testView.init()}" oncomplete="console.log('Oncomplete called')" />
</p:menu>
Expected behavior
The oncomplete script should be called independently of the action method.
PrimeFaces edition
Elite
PrimeFaces version
13.0.0 and 14.0.0-SNAPSHOT
Theme
No response
JSF implementation
All
JSF version
4.0
Java version
11
Browser(s)
All
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 28 (24 by maintainers)
Commits related to this issue
- Fix #10575: MenuItem warning in dev mode — committed to melloware/primefaces by melloware 10 months ago
- #10575 — committed to primefaces/primefaces by tandraschko 9 months ago
- Fix #10575: 13.0.2 MenuItem oncomplete script is not called if no action is specified — committed to melloware/primefaces by melloware 9 months ago
- Fix #10575: 13.0.2 MenuItem oncomplete script is not called if no action is specified (#10775) — committed to primefaces/primefaces by melloware 9 months ago
Yes only PanelGrid we are leaving as its so widely used but DataGrid and DataView etc you should switch to a responsive layout! It actually works better than the TR/TD layout that is deprecated.
I have removed that warning in 13.0.4
@firsthour feel free to submit a PR to update the PF13 migration guide: https://github.com/primefaces/primefaces/blob/master/docs/migrationguide/13_0_0.md
yes
decided to close the PR as its currently by design and we decided in the past to not log warnings for each of those nonsense-combinations
nevertheless i enhanced the code/“submitting” detection a bit
@brivalin The workaround for now is to use
listener="#{controller.noop()}"like you have done.@jepsar yes I think its this commit: https://github.com/primefaces/primefaces/commit/9d16e0fd0b01257101a0f73297ea3b6abc4a83f2
specifically…
This is the line:
isCommand = uim.getActionExpression() != null || uim.getActionListeners().length > 0;