Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrderList fires multiple reorder events #163

Closed
fanste opened this issue Apr 23, 2015 · 4 comments
Closed

OrderList fires multiple reorder events #163

fanste opened this issue Apr 23, 2015 · 4 comments
Assignees
Labels
5.1.17 5.2.2 🐞 defect Bug...Something isn't working
Milestone

Comments

@fanste
Copy link
Contributor

fanste commented Apr 23, 2015

The OrderList component supports to reorder multiple items by pressing Ctrl and using the control buttons. This is a single reorder action but it produces a reorder event per item that was reorder in that action.

In my case this causes a bug. I've a p:ajax attached to the OrderList which handles the reorder event in a listener and validates, that the reorder action produced a valid result. If the result is invalid, the previous item list is recovered and the OrderList is updated. Additionally I create a faces message that notifies the user about that recovery.

The first reorder event produces the message and resets the list, while the second one is valid and won't update the list. The user gets no message (p:growl is used here which removes all messages, as the second message set is empty) but also a reset list.

Is it possible to change that behaviour, so that a single reorder action only produces a single reorder event? It should be enough to move $this.fireReorderEvent(); out of the nested functions and only fire it if really some items have been reordered.

@hoax
Copy link

hoax commented Apr 27, 2015

Basically I agree with you. But I would prefer to have it as it is and instead provide an ReorderEvent-Object with from/to-index set, so it's possible to really track the move. How maybe a combination with additional ReorderStart/Stop-Events?!

@cagataycivici
Copy link
Member

I've replicated the issue, I also expect one reorder event to be fired regardless of the number of selected items.

@hoax, that is a different case and more of an enhancement. org.primefaces.event.ReorderEvent has fromIndex and toIndex properties already but they are not used in OrderList.

@cagataycivici cagataycivici added 🐞 defect Bug...Something isn't working 5.2.2 5.1.17 labels Apr 27, 2015
@cagataycivici cagataycivici self-assigned this Apr 27, 2015
@cagataycivici cagataycivici added this to the 5.3 milestone Apr 27, 2015
@fanste
Copy link
Contributor Author

fanste commented Apr 27, 2015

Just a question (sorry): Won't it be better to also move the $this.saveState() to the if-block? Then it won't create the options each iteration, when only the last iteration will produce the final state.

@cagataycivici
Copy link
Member

Good catch, I've done the change. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.1.17 5.2.2 🐞 defect Bug...Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants