vaadin / framework

Vaadin 6, 7, 8 is a Java framework for modern Java web applications.
http://vaadin.com/
Other
1.78k stars 730 forks source link

Adding new item to ComboBox fails if ComboBox is inside PopupView and PopupView is not closed #4906

Closed vaadin-bot closed 4 years ago

vaadin-bot commented 10 years ago

Originally by @peterl1084


Adding new item to ComboBox fails if ComboBox is inside PopupView and PopupView is not closed.

Consider following code:

protected void init(VaadinRequest request) {
   final VerticalLayout layout = new VerticalLayout();
   layout.setMargin(true);

   VerticalLayout contentLayout = new VerticalLayout();
   contentLayout.setMargin(true);
   contentLayout.setWidth("300px");

   ComboBox comboBox = new ComboBox();
   comboBox.setNewItemsAllowed(true);

   contentLayout.addComponent(comboBox);

   PopupView popupView = new PopupView("show selector", contentLayout);

   layout.addComponent(popupView);

   setContent(layout);
}

In the code there is a PopupView which has ComboBox inside. ComboBox has new value adding allowed. If user clicks inside the 'contentLayout' VerticalLayout of PopupView the ComboBox will never get the new item because RPC Call with 'newvalue' is never made. Instead if user clicks outside the content of PopupView the request is made and new value is added to ComboBox.

In short, if PopupView is not closed, the new item is not added to ComboBox.

See following requests:

a4ddd8be-188c-45af-807e-36c83a62487a[["356","v","v",["filter",["s","h"]]],["356","v","v",["page",["i","0"]]]]
a4ddd8be-188c-45af-807e-36c83a62487a[["356","v","v",["filter",["s","hh"]]],["356","v","v",["page",["i","0"]]]]
a4ddd8be-188c-45af-807e-36c83a62487a[["356","v","v",["filter",["s","hhM"]]],["356","v","v",["page",["i","0"]]]]
a4ddd8be-188c-45af-807e-36c83a62487a[["356","v","v",["filter",["s","hhMM"]]],["356","v","v",["page",["i","0"]]]]
a4ddd8be-188c-45af-807e-36c83a62487a[["356","v","v",["filter",["s","hhMMy"]]],["356","v","v",["page",["i","0"]]]]
a4ddd8be-188c-45af-807e-36c83a62487a[["356","v","v",["filter",["s","hhMMyy"]]],["356","v","v",["page",["i","0"]]]]

Indicating that after every character press request is sent to server. If user clicks inside the contentLayout no more requests are sent and empty value is selected to ComboBox.

If user click OUTSIDE of the contentLayout, following request is sent:

a4ddd8be-188c-45af-807e-36c83a62487a[["356","v","v",["newitem",["s","hhMMyy"]]],["328","com.vaadin.shared.ui.popupview.PopupViewServerRpc","setPopupVisibility",[false]]]

which adds the new item to ComboBox.

See attached screenshot.


Imported from https://dev.vaadin.com/ issue #13355

vaadin-bot commented 10 years ago

Originally by @peterl1084


Attachment added: combonewitem.png (22.8 KiB) combonewitem.png https://trac-attachments.vaadin.com/trac/13355/combonewitem.png

vaadin-bot commented 10 years ago

Originally by @peterl1084


Clicking inside the white content area never sends the 'newitem' request and resets the empty value of ComboBox. Clicking in gray background area will close the dialog and send 'newitem' request.

vaadin-bot commented 10 years ago

Originally by CodingFabian


you need to set "setImmediate(true)" otherwise the box will always wait for the next event, which is in your case the closing of the popup.

vaadin-bot commented 10 years ago

Originally by @peterl1084


Setting immediate helps but feels like a workaround because filtering is also immediate (without setting the combobox to immediate mode)

vaadin-bot commented 10 years ago

Originally by @peterl1084


Argument is that ComboBox remains empty until the popup dialog is closed (as the close event of popup sends the non-immediate 'newitem' event of ComboBox as well). When reopening the popup the content is indeed updated and new item is visible. For user (of non-immediate) ComboBox it is still very confusing that newly added value is not immediately visible but only after a server round trip that can occur from some completely different event (like closing the dialog).

vaadin-bot commented 10 years ago

Originally by @jdahlstrom


Yes, non-immediateness has quite a few unintuitive interactions with various features. Nowadays everything should be set to immediate by default. This was something we planned to do in Vaadin 7, but ended up with a compromise that the new RPC comm is immediate by default but the legacy variable changes work like in Vaadin 6.

stale[bot] commented 6 years ago

Hello there!

It looks like this issue hasn't progressed lately. There are so many issues that we just can't deal them all within a reasonable timeframe.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!

stale[bot] commented 4 years ago

The issue was automatically closed due to inactivity. If you found some new details to it or started working on it, comment on the issue so that maintainers can re-open it.