How can I sum a datatable column with JSON values?

How can I sum a datatable column with JSON values?

Josuemx10Josuemx10 Posts: 3Questions: 1Answers: 0

I have the following code and I want to sum the hours column but I can't do it

const promise1 = Promise.resolve(httpRequest.post("Post", "task/taskByProjectId", project, true));
promise1.then((value) => {
    var table = $('#table-taskByProjectId').DataTable({
        language: {
            "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Spanish.json"
        },
        paging: true,
        "bDestroy": true,
        lengthMenu: [
            [5, 15, 30, -1],
            [5, 15, 30, "Ver Todo"]
        ],
        "columnDefs": [{
            "className": "dt-center",
            "targets": "_all"
        }],
        data: value,
        columns: [
            {
                data: "nameTask",
                "render": function (data, type, row, meta) {
                    return data;
                }
            },
            {
                data: "nombreUsuario",
                "render": function (data, type, row, meta) {
                    return data;
                }
            },
            {
                data: "horas",
                "render": function (data, type, row, meta) {
                    return data;
                }
            },
        ]
    });

})

}

Can you help me please?

Answers

Sign In or Register to comment.