doubts with jsPdf - definition of columns

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" }
        ];

First column is the name of the product, in the dataKey I tried "MedPaciente.ProdutoModel.name" but it is not correct, the pdf comes out empty. already the columns qtde, To Day, lot, etc, these are normally filled (they are in the novel zero of the array).

How can I set the name of the DataKey when the element is not at level zero?

    
asked by anonymous 17.02.2018 / 16:45

1 answer

2

I assume you are talking about the AutoTable plugin for jsPDF. This functionality is not supported by the AutoTable plugin. The documentation describes the json format for columns and data and you can see that this is not possible. plugin for jsPDF

    
26.02.2018 / 13:45