jsGgrid custom field

0

I have the following script to mount a table with jsGrid

var montaGridPacientes = function (data) {
    $("#jsGrid").jsGrid({
        height: "90%",
        width: "100%",

        filtering: true,
        sorting: true,
        paging: true,
        autoload: true,
        pageSize: 20,
        pageButtonCount: 5,

        deleteConfirm: "Do you really want to delete the client?",

        data: data,



        fields: [
            { name: "CPF", type: "text", width: 50 },
            { name: "Name", type: "text", width: 150, title: "Nome" },
            { name: "DateOfBirth", type: "date", width: 60, title: "Nascimento" }

        ]
    });
    loading(false);
};

And the following result comes to me

The field of birth is with this pattern of date accepted by JSON: /Date(385441200000-0300)/

As I just step my JSON directly apra the script at: data: data,

How to put a change in this field to customize it and convert that date into a date of type 01/01/2017

    
asked by anonymous 06.12.2017 / 14:50

1 answer

0

Fixed by adding the itemTemplate:

  $("#jsGrid").jsGrid({
        height: "90%",
        width: "100%",

        filtering: true,
        sorting: true,
        paging: true,
        autoload: true,
        pageSize: 20,
        pageButtonCount: 5,

        deleteConfirm: "Do you really want to delete the client?",

        data: data,



        fields: [
            { name: "Cpf", type: "text", width: 50 },
            { name: "Name", type: "text", width: 150, title: "Nome" },
            {
                name: "DateOfBirth", type: "date", width: 60, title: "Nascimento",
                itemTemplate: function (value) {
                    return new moment(value).format('DD/MM/YYYY');
            } }

        ]
    });
    
06.12.2017 / 17:51