Date format problem in datatable

JAPJAP
edited January 11 in Technical questions

Hi

I need to show the dates with format yyyy/MM/dd HH:mm:ss, I receive from the server the date with the format "2019-01-11T10: 47: 00.7888287Z", the only way to show the correct one is with the "scheme" configuration in datatable, this work fine first time load, but when I try to parse the data after save new record or edit some record, the date rows are shown as Nan/Nan/Nan Nan:Nan:Nan.

Thanks in advance!

 var channelEmailGrid = {
            view: "datatable",
            id: "datatableid",
            navigation: true,
            select: "row",
            tooltip: true,
            scheme: {
                $init: function (obj) {
                    obj.created_at = new Date(obj.created_at);
                    obj.updated_at = new Date(obj.updated_at);
                }
            },
            columns: [
                { id: "id", header: "id", sort: "string", hidden: true },

                { id: "created_at", header: _("created_at"), sort: "date", format: webix.i18n.dateFormatStr, width: 175 },
                { id: "updated_at", header: _("updated_at"), sort: "date", format: webix.i18n.dateFormatStr, width: 175 }]
}


 function loadData(idSelectedRow) {

            webix.ajax("/data/get").then(function (result) {

                if (result.json().error == 200) {

                    let data = JSON.stringify(result.json().response);
                    $$("datatableid").parse(data);
                }
                else if (result.json().error == 404) {
                    webix.alert(_("default_notfound"), "alert-warning");
                } else {
                    webix.alert(_("default_error"), "alert-warning");
                }

            }).fail(function () {
                webix.message(_("default_error"));

            });
}
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!