SAP / openui5

OpenUI5 lets you build enterprise-ready web applications, responsive to all devices, running on almost any browser of your choice.
http://openui5.org
Apache License 2.0
2.96k stars 1.24k forks source link

sap.m.SinglePlanningCalendar missing growing functionality #3232

Open mzimnn opened 3 years ago

mzimnn commented 3 years ago

It would be nice if the SinglePlanningCalendar would support a growing functionality.

The problem is if the entity set which is bound against the appointments aggregation returns more entries than the size limit of the ODataModel, some appointments won't be shown. As a workaround it's possible to just increase the size limit but this is not very performant since a lot of entries have to be read by the OData service.

I think this could be implemented in such a way:

First the displayed start date and end date of the current view must be known. If that the case then the bound entity set can be filtered by the range of those. For example if the view shows appointments between 2020-03-01 and 2020-03-07:

/Appointments?$filter=StartDate ge datetime'2020-03-01T00:00' and EndDate lt datetime'2020-03-08T00:00'

Is the date range which is shown in the current view changed, a new requests is triggered. That way each request only returns the appointments which have to be displayed.

ravish-garg commented 3 years ago

@mzimnn You can possibly use the event startDateChange to fire off a new oData request with date range filters

mzimnn commented 3 years ago

I have implemented a simple custom control.

It does nothing fancy, it just calls the OData service for the date range of the current view but does not check if the range was already read. Furthermore, it's not working with the month view right now because I'm using the internal method _getFirstAndLastRangeDate() to get the date range and the month view doesn't return a correct end date.

ravish-garg commented 3 years ago

I have implemented a simple custom control.

It does nothing fancy, it just calls the OData service for the date range of the current view but does not check if the range was already read. Furthermore, it's not working with the month view right now because I'm using the internal method _getFirstAndLastRangeDate() to get the date range and the month view doesn't return a correct end date.

@mzimnn I am using the control as well, and I found the month view to be problematic too. The route I chose was to load a month's worth of data in one go, and checking on navigation between views/dates, if the data is already loaded or not for the startDate/endDate of the view. To work out the correct start date/end date of the view, I used moment.js to add relevant number of days depending on the view selected by the user. For week - 7, fortnight- 15, month -42, as the control shows a grid of 6x7 boxes(so your month view can display previous or next month days). Add 42 to the startDate of the month view date and you can then work out if the data is already loaded or not in the oData model, by querying by the entity key. Hope this provides some alternative ideas to you until the UI5 teams provides a proper "growing" solution.

mzimnn commented 3 years ago

@ravish-garg Thanks for giving some insights about how you solved this.

I have found the method SinglePlanningCalendarMonthGrid._getVisibleDays() which calculates all days shown in the month view. That way the start date and end date can easily be retrieved.

I added this to my custom control which means it supports now the month view as well.

For now the custom control pretty much covers my use case but an official growing functionality would be a lot nicer.

dobrinyonkov commented 3 years ago

Hello @mzimnn,

Thank you for sharing your enhancement proposal. I've created an internal incident 2180198340. The status of the issue will be updated here in GitHub.

Regards, Dobrin

flovogt commented 2 years ago

This enhancement will be covered in backlog item BGSOFUIBALKAN-5876.