doubts with jsPdf - column definition

Asked

Viewed 182 times

0

I have the following json

{
"MedPaciente": [
    {
        "ProdutoModel": {
            "LaboratorioModel": {
                "id_laboratorio": 7951,
                "nome": "BOEHRINGER INGELHEIM",
                "data_cad": "28/12/2017",
                "situacao": 1
            },
            "id_produto": 232,
            "id_laboratorio": 7951,
            "codbarras": "7896026300704",
            "nome": "ANADOR 500MG 2COMP ",
            "situacao": 1,
            "alldata": "ANADOR 500MG 2COMP ",
            "data_cad": "17/01/2001"
        },
        "id_med_paciente": 44,
        "id_empresa": 1,
        "id_consulta": 59,
        "id_paciente": 4,
        "id_produto": 232,
        "qtde_embalagem": 20,
        "dose_diaria": 2,
        "lote": "1231",
        "vencto": null,
        "crm": "1325",
        "uf_crm": null,
        "medico": "aluisio da silva reis",
        "dt_lancto": "2018-02-06T00:00:00",
        "termino": "2018-02-26T00:00:00",
        "tipo": "medicamento",
        "qtde": 2
    }

}

the following code defines the column name and its dataKey

 var columns = [
            { title: "Nome", dataKey: "MedPaciente.ProdutoModel.nome" },
            { title: "Laboratório", dataKey: "lab" },
            { title: "Qtde", dataKey: "qtde" },
            { title: "Ao Dia", dataKey: "dose_diaria" },
            { title: "Lote", dataKey: "lote" },
            { title: "Vecnto", dataKey: "vencto" },
            { title: "CRM", dataKey: "crm" },
            { title: "Médico", dataKey: "medico" }
        ];

The first column is the product name, in dataKey tried "Medpaciente.ProdutoModel.name" but not sure, the pdf comes out with the empty name. ja columns Qtde, To Day, lot, etc, these are usually filled (they are in the novel zero of the array).

how can I set the Datakey name when the element is not at zero level?

1 answer

0

I assume you’re talking about the Autotable plugin for jsPDF. This feature is not supported by the Autotable plugin. The documentation describes the json format for columns and data and you can see that you can’t do that. plugin for jsPDF

Browser other questions tagged

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