cancel
Showing results for 
Search instead for 
Did you mean: 

sap.ui.unified.Calendar , refresh when i click on date and removes styles attachecd to it

aleks_dev
Explorer
0 Kudos

Hello, I have a problem with the calendar sap.ui.unified.Calendar, when I click on a date I lose all the changes and I have to do all from the beginning, attaching the function, is there any way that I can stop the refreshing of the calendar to make the style not disappear from the calendar?

var startDate = new Date(

				formatter.getFirstDayFromMonth(this.actualYear, this.actualMonth - 1)
			).getDate();
			var endDate = new Date(
				formatter.getLastDayFromMonth(this.actualYear, this.actualMonth)
			).getDate();
			var getSelected = this.legendModel.getProperty("/wbs");
			var getAllSelected = getSelected.filter((item) => item.select === true);
			for (var i = startDate; i < endDate + 1; i++) {
				i = i < 10 ? "0" + i : i.toString();
				var actualMonth =
					this.actualMonth < 10
						? "0" + this.actualMonth
						: this.actualMonth.toString();
				var data = this.actualYear + "" + actualMonth + "" + i;
				var dataSelected = this.actualYear + "-" + actualMonth + "-" + i;
				var selectedDate = $('[id$="Month0-' + data + '"]')[0];
				var getFilteredData = this.activitySet.filter(
					(x) => x.DATA_ATTIVITA === dataSelected
				);
				let colors = "";
				let check = 0;
				let col = 4;
				var removeDuplicates = this.removeDupl(getFilteredData, 'CODICE_COMMESSA')
				for (let i = 0; i < removeDuplicates.length; i++) {
					var getChecked = getAllSelected.find(
						(obj) => obj.description === removeDuplicates[i].CODICE_COMMESSA
					);
					if (check == 0 && getChecked) {
						check = 1;
						colors += `inset 4px 0rem 0 ${this.arrayColori[i]}`;
					} else if (check > 0 && getChecked) {
						col = col + 4;
						colors += ` , inset ${col}px 0rem 0 ${this.arrayColori[i]}`;
					}
				}
				check = 0;
				col = 0;
				selectedDate.style.boxShadow = colors;
			}       

            <u:Calendar
                id="timesheetCalendar"
                select="onPressSingleDay"
                startDateChange="_setPage"
                class="sapUiSmallMarginBegin sapUiTinyMarginTop"
                showWeekNumbers="false"
                specialDates="onThisDate"
            /><br>

Accepted Solutions (0)

Answers (0)