openui5
openui5 copied to clipboard
Enh. Suggestions for sap.m.PlanningCalendar
OpenUI5 version: 1:36.0
I have been working on an extension of the PlanningCalendar, below are some the changes i have made which i think could be included. All changes came from customer feature requests. I would make a PR but guessing some changes already in pipeline.
- SubIntervals can be set on the PlanningCalendarView but not directly on the PlanningCalendar, customer wants to see intervals every 15 minutes when on hour view
- Min and Max dates, customer wants to control how far into the past and future users can go
- EndDate, needed for Selecting Data for the current view, need to be able to determine both the StartDate and the EndDate eg
SELECT * FROM Appointments WHERE Start < EndDate AND End > StartDate
example code
metadata: {
properties: {
minDate: { type: "object", group: "Data" },
maxDate: { type: "object", group: "Data" },
showSubIntervals: { type: "boolean", group: "Appearance", defaultValue: false}
....
PlanningCalendar.prototype.setViewKey = function(sKey) {
..
oView.setShowSubIntervals(this.getShowSubIntervals()); //1 a getView would be nice
if (this.getMinDate() && this._oTimeInterval) { //2
this._oTimeInterval._oMinDate = new UniversalDate(this.getMinDate());
}
if (this.getMaxDate() && this._oTimeInterval) { //2
this._oTimeInterval._oMaxDate = new UniversalDate(this.getMaxDate());
}
},
...
PlanningCalendar.prototype.getRowEndDate = function() {
// this._iRowSize = oCalendarRow._iRowSize; - derived @ onBeforeRendering
return new Date(this.getStartDate().getTime() + this._iRowSize); //3
},
I have an additional change besides the ones of @jasper07: It would be handy to have an event such as in the updateFinished sap.m.ListBase that informs us when the data is in the control.
When you want to only fetch the appointments for the visible Date Interval you need to be able to add the filter on the appointments, but you can only perform this.getModel().read("/AppointmentSet, ..."
when the rows are received.
Currently we are doing a manual bindAggregation with an expand, but then you need to have the startDate and endDate property also on the Rows-entitySet, to solve this is the Gateway or other backend.
Regards,
Robin
Contacted the content expert to let him know about your suggestions. @rpanneel @jasper07 You can also think about a contribution, this will definitely be faster than if we do it by ourselves as we usually have a lot of feature backlog on our tables.
First, we should clarify however if these suggestions make sense for all our stakeholders Get in touch with us if you plan to contribute some of the features.
@thomaskoetter what do you think about these suggestions?
Kind Regards, Michael
@Michadelic @thomaskoetter
Suggestion 2 - max and min dates was already added
I have an open PR with the suggestions 1 + 3
- showSubIntervals - i didnt test the setter, need some guidance on how to proceed
-the default behaviour of PC is to create 3 Views if no View specified, I added metadata and logic to set showSubInterval on View Set ran the QUnit tests and test for Views broke because of an iimplicit PC.addView where showSubInterval set true
My thinking is the majority of times PC Views aggregation will not be set, therefore setter code not needed, thoughts on how to proceed
Hi, see my comments in https://github.com/SAP/openui5/pull/928: suggestion 1 is either not fully understood or not desired, suggestion 3 is nice, there are only implementation concerns. (suggestion 2 is already implemented).
Regards Andreas