Versão atual:

Gerar PDF e buscar dados dentro do paifilho

Estou usando o PDFmake para gerar meu pdf, porém os dados do paifilho são inseridos na atividade inicial, e o PDF e gerado em uma atividade posterior a inicial. Gostaria de uma ajuda de como criar essa buscar de dados sendo que ao inspecionar meu código o id do campo vem dessa forma _teste1. segui o código de como criei o script de gerar o PDF. No arquivo estou chamando o valor do campo dessa forma $('#codProduto1').val()

CÓDIGO:

$('#printPdf').click(function() {

var printPdfPedidoCompras = { content: [

{text: 'PEDIDO DE COMPRAS', style: 'header'}, {image: 'logo.png', width: 150, height: 150,}, {text: 'Dados do Solicitante', margin: [0, 20, 0, 8]}, { style: 'tableExample', table: { headerRows: 1, body: [ [ {text: 'Data Abertura', style: 'tableHeader'}, {text: 'Nome', style: 'tableHeader'}, {text: 'Número da Solicitação', style: 'tableHeader'}, {text: 'Número do Pedido', style: 'tableHeader'} ], [ $('#dataAbertura').val(), $('#nomeSolicitante').val(), $('#numSoli').val(), $('#numPedido').val() ],

] },

layout: { hLineWidth: function (i, node) { return (i === 0 || i === node.table.body.length) ? 2 : 1; }, vLineWidth: function (i, node) { return (i === 0 || i === node.table.widths.length) ? 2 : 1; }, hLineColor: function (i, node) { return (i === 0 || i === node.table.body.length) ? 'black' : 'gray'; }, vLineColor: function (i, node) { return (i === 0 || i === node.table.widths.length) ? 'black' : 'gray'; },

} },

{text: 'Informações Sobre o Produto', margin: [0, 20, 0, 8]}, { style: 'tableExample', table: { headerRows: 1,

body: [ [ {text: 'Cod Produto', style: 'tableHeader'}, {text: 'Produto', style: 'tableHeader'}, {text: 'Fornecedor', style: 'tableHeader'}, {text: 'Tel Fornecedor', style: 'tableHeader'},

], [ $('#codProduto1').val(), $('#zoomProduto1').val(), $('#zoomFornecedor1').val(), $('#telFornecedor1').val(),

],

] },

layout: { hLineWidth: function (i, node) { return (i === 0 || i === node.table.body.length) ? 2 : 1; }, vLineWidth: function (i, node) { return (i === 0 || i === node.table.widths.length) ? 2 : 1; }, hLineColor: function (i, node) { return (i === 0 || i === node.table.body.length) ? 'black' : 'gray'; }, vLineColor: function (i, node) { return (i === 0 || i === node.table.widths.length) ? 'black' : 'gray'; },

} },

Versão (1):

Ver a versão formatada

Gerar PDF e buscar dados dentro do paifilho

Comentário

new question