Usage of View Change callback in Calendar widget

Hello Mendix Community: I have been using the latest Calendar widget (version 4.2.4) to allow Members (specializations of System.User) to reserve pieces of Equipment. When they select a piece of Equipment from a data grid, the reservations (stored in an entity named Record) of that piece of Equipment are shown. Originally, I simply used an Xpath database query that selected the appropriate "Records" (the Entity shown in the calendar) based on the Xpath constraint where the %CurrentObject% is a piece of Equipment: [LabOps.Record_Equipment = '[%CurrentObject%]'] While that works, it imports all Records (that is, reservations) for that piece of Equipment for all time. Over time, that could become thousands or tens of thousands of Records for each piece of Equipment. It seems is if a better way to handle this is to use the "View Change" callback that will give me the ViewStart and ViewEnd datetimes of the current calendar view and then use those datetimes in a Microflow to retrieve ONLY those reservations that will be visible in the datetime range of the current calendar view for a particular piece of equipment ... which might be either a single day, a week, or a month, depending on the calendar view. If I am reading the Calendar documentation correctly, I think that I need two microflows: The first one takes the calendar callback and stores the current view start and view end properties in an entity. I've called that entity CalendarView and the microflow that is called to store the view data is named LabOps.IVK_UpdateCalendarView. I have tried to make that entity a 1:1 association with each Member. This is the microflow that is specified in the "On view change" property of the "View Change" panel of the Calendar properties. Then I need a microflow to use that information to return the applicable list of Records and hand them to the calendar widget for display. I have called that microflow LabOps.IVK_ShowCalendar. Note: I am using the "Microflow with Context Object" option so the IVK_ShowCalendar microflow is what I have specified on the "Davaview data source microflow" property on the "Dataview context (Optional)" panel of the Calendar properties panel. I think that I need to use the "Microflow with Context Object" option so that the calendar "listens to" the selected piece of equipment. Here is the LabOps.IVK_UpdateCalendarView microflow: Here is the LabOps.IVK_ShowCalendar microflow: Note: both of these microflows have an extra blocking message to show either the details of the updated calendar view or the number of records found in the new time window. While both of these microflows appear to do what I expect them to do, no events (Records) are actually displayed in the Calendar. This leads me to believe that I need to do something to trigger a refresh of the display over and above having the list of Records returned by the IVK_ShowCalendar microflow. Of course, it is entirely possible that I have misunderstood what the IVK_UpdateCalendarView and the IVK_ShowClaendar view should be doing. I'd appreciate it if anyone can help me to better understand what I am missing to make use of the Calendar ViewChange callback. Also, is having a 1:1 association between the Member and the ViewChange entity appropriate or should the ViewChange be associated with a session in case a member has more than one instance of the application running? Thanks, John
0 answers