Skip to content

Instantly share code, notes, and snippets.

@LeandroLS
Last active September 4, 2017 19:08
Show Gist options
  • Save LeandroLS/2f1ac26e8a0ee86e426da5e956eb9fd6 to your computer and use it in GitHub Desktop.
Save LeandroLS/2f1ac26e8a0ee86e426da5e956eb9fd6 to your computer and use it in GitHub Desktop.
Template String com .map dentro
success: (retorno) => {
let tr = `
<table class='table'>
<thead>
<th></th>
<th>Descrição</th>
<th>Tamanho</th>
<th>Modelo</th>
<th>Tecido</th>
<th>Madeira</th>
<th>Vidro</th>
<th>Medida</th>
<th>Fornecedor</th>
<th>Local</th>
</thead>
<tbody>
${retorno.map((item) =>
`<tr style='background-color: white'>
<td><input type="checkbox"></td>
<td>${item.descricao}</td>
<td>${item.altura} x ${item.largura} x ${item.profundidade} </td>
<td>${item.modelo}</td>
<td>${item.caract1}</td>
<td>${item.caract2}</td>
<td>${item.caract3}</td>
<td>${item.medida}</td>
<td>${item.fornecedor}</td>
<td>${item.local}</td>
</tr> ` //fim template
)}
</tbody>
</table>
`//fim template
$('#tabelaProduto').html(tr);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment