Clearing the value inside

Posted by: sidharthsurendran on 14 September 2017, 3:11 am EST

    • Post Options:
    • Link

    Posted 14 September 2017, 3:11 am EST

    I am using <wj-input-date> inside Angular2. Is there any way we can clear the date inside the cell?

  • Posted 14 September 2017, 3:11 am EST

    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

  • Posted 14 September 2017, 3:11 am EST

    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?

  • Posted 14 September 2017, 3:11 am EST

    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:

    <wj-input-date [isRequired]="false"
                   [(value)]="val">
    </wj-input-date>
    //TS
    class App{
      public val=null; //<--- "" can be also used instead of null
    }

    Thanks,

    Manish Kumar Gupta

  • Posted 3 October 2017, 1:20 am EST

    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>
    
  • Posted 3 October 2017, 8:45 pm EST

    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