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.
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.
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.