jsGgrid custom field

Asked

Viewed 26 times

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 I get the following result

Ignorem a cor cinza das letras

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

As I just pass my JSON directly apra the script in: data: data,

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

1 answer

0

Fixed by adding the item:

  $("#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');
            } }

        ]
    });

Browser other questions tagged

You are not signed in. Login or sign up in order to post.