Skip to content Skip to sidebar Skip to footer

Date.gettime Is Not A Functioin Extjs Datefield Column

During the date filter in grid I am getting this error. Uncaught TypeError: date.getTime is not a function at Object.clearTime (ext-all-rtl-debug.js?_dc=1591679946477:6514)

Solution 1:

The problem is not in the renderDate function, its function name should otherwise show up in the stack trace.

The stack trace hints to filters. The cause of the problem seems to be that you apply a filter of type date to the model field on the store backing the grid column. Said filter requires the backing model field to contain javascript date objects (or null), not (date-parseable) non-empty strings. At least one record loaded into the store does not contain a valid javascript date object in the date field.

You have to ensure that the model fields config defines the date field as type date, and that you provide the correct dateFormat so that the date strings are correctly converted to javascript date objects by the store on load:

fields: [{
    name: "date",
    type: "date",
    dateFormat: "Y-m-d H:i:s"// whatever the format is in which you expect the date string from the backend
}]

If that solution attempt does not solve it for you, please post your store/model definition code and the data you load into the store.

On a side note, the datecolumn allows you to provide the date display format as format config, no custom renderer required.

In short, the store/model field (type: "date") dateFormat is needed to transform whatever date string you get from the backend, into a javascript date object; the filter (type: "date") then works with a javascript date object only; and then finally the column (xtype: "datecolumn") format knows how to transform that javascript date object back to a human-readable format (which can be and usually is different from the format that the backend transmits to the UI).

Post a Comment for "Date.gettime Is Not A Functioin Extjs Datefield Column"