clearing the value inside

Originally Posted 28 July 2017, 5:32 am EST

  • Originally Posted 28 July 2017, 5:32 am EST

    I am using inside Angular2. Is there any way we can clear the date inside the cell?
  • Reply

    Hi sidharth,

    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.

    Thanks,
    Abhishek

  • Reply

    Thanks 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

    Reply

    Hello Sidharth,
    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:
                   [(value)]="val">

    //TS
    class App{
    public val=null; //<--- "" can be also used instead of null
    }



    Thanks,
    Manish Kumar Gupta
  • Reply

    I 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>
    </ng-template>
    </wj-flex-grid-column>
  • Reply

    Hi Benjamin,
    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.


    Thanks,
    Manish Kumar Gupta
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels