I have the following table that is filled when making a formula
What I must do is that when I click on a button to export, I create a json with the code and the quantity, and I put it to a function. This is what I have:
$(document).ready(function(){
$('.exportar').click(function(){
var imgData = canvas = document.getElementById($(this).attr('rel')).toDataURL("image/png");
var pdf = new jsPDF;
pdf.addImage(imgData, 'PNG', 10, 10);
var download = $('.exportar');
pdf.save("download.pdf");
jsonObj = [];
$("table[class=rc]").each(function(){
var id = $(this).attr('.muestra');
var codigo = $(this).val();
item = {}
item [".muestra"] = id;
item [".codpex"] = codigo;
jsonObj.push(item);
});
console.log(jsonObj);
var scope = window.parent.angular.element(window.frameElement).scope();
scope.$ctrl.procesarLineas(jsonObj);
scope.$apply();
});
});
sample is the class of the code field and codepex is the quantity class.
This is the table
**<table class="rc">
<tr>
<th >Código</th>
<th >Cantidad</th>
</tr>
<tbody>
<tr>
<td id='codpcentral' class='codpcentralx'></td>
<td id='npcentral' class='npcentralx'></td>
</tr>
</tbody>
</table>**