Angular agDatePickerComponent not working on empty or blank ag grid cell

39 views Asked by At

I am using an agrid column in angular version 8. I have a column which is a date field. Which can have blank date as well. Now when I have value inside the cell for example 2023-04-01 and I click on the cell. I get a date picker but when the cell is empty and I click on it instead of getting a date picker. I get an error stating

ERROR TypeError: Cannot read properties of null (reading 'split')
    at push../src/app/common/components/ag-datepicker/ag-datepicker.component.ts.agDatePickerComponent.agInit 

My ag grid with date column

What I tried

TS file code

{
            headerName: "Received Date",
            field: "received_date",
            autoHeight: true,
            filterParams: { comparator: agDateComparator },
            cellEditorFramework: agDatePickerComponent,
            cellEditorParams: {
                inlineFlag: false,
            },
            editable: this.checkReceivedDate.bind(this),
            valueGetter: params => {
                return params.data.received_date === "None" || undefined ? "" : (params.data.received_date)
            }
        },

What I am expecting is I should get a date picker even if the cell value is blank or empty..

PS: I am new to angular and ag-grid any help would be appreciated..

0

There are 0 answers