JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Date & Time Pickers › DatTimePicker "change" event not firing
- This topic has 4 replies, 2 voices, and was last updated 3 years, 7 months ago by davout.
-
AuthorPosts
-
April 14, 2021 at 2:17 pm #101700davoutMember
In my Angular app I am trying to capture the value of a new DateTimePicker value after it has been selected using the ‘(change)’ event
Like…<smart-date-time-picker *ngIf="isInlineEditing(rowIndex + '-scheduled')" formatString="ddd dd-MMM-yyyy" dropDownDisplayMode="calendar" drop-down-position="bottom" calendar-button placeholder="for" style="width: 180px" [nullable]="true" [autoClose]="true" [value]="value" [dropDownAppendTo]="'body'" (change)="updateScheduledValue($event)" > ... but when I select a new date from the drop down the change event is not being fired
April 14, 2021 at 2:33 pm #101701adminKeymasterHi davout,
We use this for testing:<smart-date-time-picker (change)="change($event)" #datetimepicker [calendarButton]="true" [enableMouseWheelAction]="true" [dropDownPosition]="'center-bottom'" [spinButtons]="true" [spinButtonsPosition]="'left'"></smart-date-time-picker>
app.component.html
import { Component, ViewChild, OnInit, AfterViewInit } from '@angular/core';import { DateTimePickerComponent } from '@smart-webcomponents-angular/datetimepicker';@Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css']})export class AppComponent implements AfterViewInit, OnInit { @ViewChild('datetimepicker', { read: DateTimePickerComponent, static: false }) datetimepicker: DateTimePickerComponent; change(event): void { console.log(event.detail.value); } ngOnInit(): void { // onInit code. } ngAfterViewInit(): void { // afterViewInit code. this.init(); } init(): void { // init code. } }
The reported behavior cannot be reproduced. Please, share a Stackblitz sample showing incorrect behavior and instructions how to reproduce it.
Best regards,
Peter Stoev
Smart UI Team
https://www.htmlelements.com/April 14, 2021 at 2:54 pm #101704davoutMemberI’ve noticed that I have to select the new date value twice before the ‘change’ event is triggered
The date time picker is inside a template that is used for table cell editing<ng-template #scheduledDateTemplate let-row="row" let-rowIndex="rowIndex" let-value="value"> <span (click)="startInlineEdit(rowIndex + '-scheduled', rowIndex)" *ngIf="!isInlineEditing(rowIndex + '-scheduled')" title="Click to edit" > {{ value }} </span> <smart-date-time-picker *ngIf="isInlineEditing(rowIndex + '-scheduled')" formatString="ddd dd-MMM-yyyy" dropDownDisplayMode="calendar" drop-down-position="bottom" calendar-button placeholder="for" style="width: 180px" [nullable]="true" [autoClose]="true" [value]="value" [dropDownAppendTo]="'body'" (change)="updateScheduledValue($event)" > </smart-date-time-picker> </ng-template>
April 14, 2021 at 3:11 pm #101705adminKeymasterHi davout,
we will need a full stackblitz.com sample. Unfortunately, the provided information is insufficient for reproduction of an issue with our angular datetimepicker.
Best regards,
Peter Stoev
Smart UI Team
https://www.htmlelements.com/April 14, 2021 at 3:27 pm #101706davoutMemberI’ve managed to solve it by pointing the datetimepicker at a component class value, not the table cell value pushed to it by the template
# -
AuthorPosts
- You must be logged in to reply to this topic.