Originally Posted 28 July 2017, 5:32 am ESTI am using
clearing the value inside
Originally Posted 28 July 2017, 5:32 am EST
inside Angular2. Is there any way we can clear the date inside the cell?
I am not sure what you mean by clear the date inside cell. You can easily access the Input Date Control inside your Component and set it's text to an Empty string and it should clear it. I would request you to kindly provide some additional information on your use case so that we can suggest you a suitable solution.
ReplyThanks for the reply. I will now elaborate. The cell I am concerned about can contain or not contain a date. There should be an option for the user to not give the date in this cell. Now what happens is, the current date appears in the cell automatically and even if i try to clear the cell (by clicking on the cell and then performing backspace), when I tab out of the cell, current date appears again. So there should be something which can clear the date value that user had entered. And also, by default, today's date should not come in the cell.Is there any way I can achieve this?
Marked as Answer
You can clear date in InputDate control by setting isRequired property to false. It allows you to set date to empty or null. For your reference, please refer to the following code snippet for the same:
public val=null; //<--- "" can be also used instead of null
Manish Kumar Gupta
ReplyI am experiencing the same problem where I cannot clear the date field value. I have isRequired set to false in the column editor configuration.
<wj-flex-grid-column [header]="'gatewayApp.module.purchaseDate' | translate" [binding]="'purchaseDate'" [width]="135" [data-type]="4" [format]="'yyyy-MM-dd'">
<ng-template wjFlexGridCellTemplate [cellType]="'CellEdit'" let-cell="cell">
<wj-input-date [(value)]="cell.value" [isRequired]="false" [format]="'yyyy-MM-dd'"></wj-input-date>
We are sorry for the inconvenience.
The isRequired property should be set to false before binding the value to control as per code snippet shared in the previous reply.
Manish Kumar Gupta