0

I have a kendo component kendo-datetimepicker (angular project, kendo-angular)

When I open the calendar, start typing the date (day, month, year) and time (hours, minutes) in the input, right at the end when I select minutes - the calendar closes automatically.

The issue could be checked here: https://www.telerik.com/kendo-angular-ui/components/dateinputs/datetimepicker/date-time-limits/

Any way to prevent the calendar from closing?

And close, only when I click on cancel or set button?

Dmytro Mysak
  • 1,206
  • 15
  • 28
  • If you're using a DateTimePicker, why type in the time manually? I tested it just now and the dropdown closes right as I start typing, no matter which field I'm entering... – Shai Jan 02 '22 at 11:13

1 Answers1

0

I think you can call the toggle method on the blur event to keep it open. Stackblitz example here. setTimeout is needed so that the method is call is put on the stack and does not run immediately.

import { Component, ViewChild } from '@angular/core';

import { DateTimePickerComponent } from '@progress/kendo-angular-dateinputs';

@Component({
    selector: 'my-app',
    template: `
        <div class="container-fluid">
            <div class="row">
                <p class="col-md-6">
                    <kendo-datetimepicker #datePickerChild
                        (blur)="onBlur()"
                    >
                    </kendo-datetimepicker>
                </p>
            </div>
        </div>
    `,
})

export class AppComponent {
    @ViewChild('datePickerChild', { static: false })
    public datePickerChild!: DateTimePickerComponent;
    constructor() {
        setTimeout(() => {
            this.datePickerChild.toggle();
        });
    }

    public onBlur(): void {
        setTimeout(() => {
            this.datePickerChild.toggle();
        });
    }
}
xinthose
  • 3,213
  • 3
  • 40
  • 59