Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Filter calendar items(Filter calendar items)
Filter calendar items [message #791205] Sun, 05 February 2012 07:50 Go to next message
Bertin Kiekebosch is currently offline Bertin Kiekebosch
Messages: 300
Registered: August 2011
Senior Member
The calendar has a method execFilterCalendarItems that is executed when items are loaded. I call the database and load all the appointments of a user for a particular week. This is a heavy operation on the database that results for average a few 200 appointments.

I want to give the user a menu with options to filter the items on the calendar. How can I trigger the execFilterCalendarItems but not reload everything from the database.

Regards bertin
Re: Filter calendar items [message #793020 is a reply to message #791205] Tue, 07 February 2012 12:14 Go to previous messageGo to next message
Matthias Villiger is currently offline Matthias Villiger
Messages: 78
Registered: September 2011
Member
Hi Bertin,

The execFilterCalendarItems method is only invoked, when new items have been loaded from the providers.

The easiest way to achieve your task would be to introduce some logic in the method execLoadItems (or execLoadItemsInBackground) to only fetch the data from the database when the date range has changed.
For this you can remember the last range (minDate, maxDate) for each provider and only fetch data from the database when it is different than the last time. If it is the same range you can just add the already existing items into the holder (you can access them using getCalendar().getComponents()).
Then you can trigger a reload on the calendar by calling reloadCalendarItems(). This invokes execLoadItems (which does no DB call anymore) and afterwards execFilterCalendarItems which gives you the opportunity to apply the new filter.

Does this answer your question?
Regards,
Matthias
Re: Filter calendar items [message #793123 is a reply to message #793020] Tue, 07 February 2012 15:08 Go to previous message
Bertin Kiekebosch is currently offline Bertin Kiekebosch
Messages: 300
Registered: August 2011
Senior Member
Hi Matthias,

I figured out something simular, but with your answer I know now I am not doing something in a completely wrong way that could be done more easily by using Scout in a better way.

Regards Bertin
Previous Topic:CodeType with codes from the database
Next Topic:AbstractImageField with scrollbar
Goto Forum:
  


Current Time: Wed Jul 30 09:13:54 EDT 2014

Powered by FUDForum. Page generated in 0.01527 seconds