timeline - clear selection

Community Driven Extensions Project
Post Reply
herbu
Posts: 24
Joined: 09 Oct 2013, 19:13

19 Jan 2015, 15:08

Hello,

when I click a timelineEvent it gets selected and ajax is fired (event="select").
Now, I want to select the same event and get the ajax fired once more - but the event is already selected and no action is performed.

In my case one solution could be to clear the selection after the first ajax is completed -> thus the question:

on a timeline - how can one clean the selection from bean? (and/or javascript)

Regards,
Herbu


PrimeFaces Extention 2.1.0

User avatar
sudheer
PrimeFaces Core Developer
Posts: 4345
Joined: 16 Oct 2011, 19:19
Location: Singapore

23 Jan 2015, 20:35

AFAIK,there is no unselect client side API function available.But you can unselect the event by clicking outside of the target event.In your case,You can use clear method on TimelineUpdater Server side API.Check this example.http://www.primefaces.org/showcase-ext/ ... Server.jsf
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

herbu
Posts: 24
Joined: 09 Oct 2013, 19:13

26 Jan 2015, 16:14

Hi sudheer,

some kind of workaround that did work for me (maybe sb. will be interested):

bean:
TimelineModel model;
...
timelineUpdater = TimelineUpdater.getCurrentInstance( ((Timeline) this.selectedEvent.getSource()).getClientId() );
model.delete( selectedEvent.getTimelineEvent(), timelineUpdater );
model.add( selectedEvent.getTimelineEvent(), timelineUpdater );


In my case I have stacked events and adding an event looks kind of strange for a user. So additionally I added:
<pe:timeline ....
animate="false" />


Regards,
herbu

User avatar
sudheer
PrimeFaces Core Developer
Posts: 4345
Joined: 16 Oct 2011, 19:19
Location: Singapore

27 Jan 2015, 08:32

Thats great.Have you tried with clear instead delete operation?
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

30 Jan 2015, 11:34

There is "unselectable" attribute:

"If true, you can unselect an item by clicking in the empty space of the timeline. If false, you cannot unselect an item, there will be always one item selected. Default is true."

AFAIK, there is also server-side method "unselect" in TimelineUpdater / Model.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 12 guests