question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SplitButton: Both action button and action item are executed

See original GitHub issue

Describe the defect The core refactoring of @Rapster (#5009) introduced a bug to p:splitbutton and maybe to other components (did not check it). Before the code changes the logic of super.decode() was inside an if block and the code below was inside an else-if block (see here).

That means, that both action listeners will be executed. The one of the menu item in super.decode() and the one from the standalone if block. But only the one of the menu item should be executed if a menu item was clicked.

This seems to happen only to a splitbutton that uses the model attribute.

Reproducer https://github.com/fanste/primefaces-test/tree/test-6192

Environment:

  • PF Version: 8.0
  • JSF + version: Mojarra 2.1.19
  • Affected browsers: ALL

To Reproduce Steps to reproduce the behavior:

  1. Go to ‘index.jsf’
  2. Click on ‘ALL’
  3. Only the ALL action listener is executed
  4. Click on any menu item of the split button
  5. Action listener of ALL and menu item is executed

Expected behavior Already explained in the defect description

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
fanstecommented, Aug 4, 2020

That was a short debug session 😄

Static p:menuItem will be handled by UIMenuItem itself while the dynamic one will be handled by the SplitButton. The proposed fix should be the correct way.

Let MenuItemAwareRenderer#decode return true/false and SplitButtonRenderer#decode should handle that return value.

0reactions
fanstecommented, Aug 5, 2020

Thanks for the PR. I can confirm, that everything is working now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript SplitButton API control - Syncfusion
Specifies action items with its properties which will be rendered as SplitButton secondary button popup. Defaults to []. locale. string. Overrides the global ......
Read more >
Actions inside of another action like Netbeans - java
SplitButton. Basically, if you click the button, it will run the "default" action (Bananas) otherwise you can select one of the sub elements ......
Read more >
Split Buttons - Alpha Anywhere Documentation
Split buttons are comprised of one button divided into two parts. This arrangement provides users the option of running an action or selecting...
Read more >
Split Button - Telerik UI for WPF - Documentation
The split button control implements the ICommandSource interface, which allows you to attach commands to the ButtonPart, that will be executed when the...
Read more >
Split Button | Calcite Design System - ArcGIS Developers
Calcite Split Buttons are essentially two buttons paired to provide different but related actions. Overview. Used to house variations of the same action, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found