I'm developing a routine with a pivot table using javascript, where when I open the routine a button 'ADD TABLE' appears
Whentheuserclicks'ADDTABLE'thetableheaderappearsandan'ADD'buttonthatisresponsibleforaddingrowstothetable.
Theproblemisthis:Iwouldliketoperformaselectinthedatabase'SQLSERVER'usingjavascript+php.Whentypingtheordernumberintherequestedcolumntheothercolumnsareautomaticallycompletedwiththedataoftheorderentered.
EX01:Ientertheordernumber
Whenenteringtheordernumberandgivinga'TAB',thesystemgivesaselectinthedatabasebringingthecolumndata:'DATEISSUE','FINANCIALRELEASE','FACTORYDAYS','CUSTOMER','UF','VALUE','VOLUME','WEIGHT'fortherequestedorder.
Followthecode:
$("#multiuso").append(newRow);
var liveTableData = $('table').tableExport({formats: ["xlsx","xls", "csv", "txt"], });
liveTableData.reset();
// função para adicionar linhas na tabela especifica, .addRows+n+ = id criado dinamicamente para que ao clicar no botão o sistema inclua a linha na tabela do is especifico
$(".addRows"+n+"").on('click',function(){
//alert(n);
//Variável que recebe a linha que será adicionada na tabela.
var newRowContent = '<tr>';
newRowContent += '<td>'+n+' ENTREGA</td>';
newRowContent += '<td contenteditable="true" class="numPedido" id = "numPedido" name ="numPedido[1]" ></td>';
newRowContent += '<td class="dtEmissao" id = "dtEmissao" name ="dtEmissao[2]" ></td>';
newRowContent += '<td class="dtLibFin" id = "dtLibFin" name ="dtLibFin[3]" ></td>';
newRowContent += '<td class="diaFabrica" id = "diaFabrica" name ="diaFabrica[4]"></td>';
newRowContent += '<td class="cliente" id = "cliente" name ="cliente[5]"></td>';
newRowContent += '<td class="uf" id = "uf" name ="uf[6]"></td>';
newRowContent += '<td class="valor" id = "valor" name ="valor[7]"></td>';
newRowContent += '<td class="volume" id = "volume" name ="volume[8]"></td>';
newRowContent += '<td class="peso" id = "peso" name ="peso[9]"></td>';
newRowContent += '<td class="actions">';
newRowContent += '<button class="btn btn-large btn-danger removebutton" type="button">Remover</button> </tr>';
newRowContent += '</tr>';
$(newRowContent).appendTo($("#tab"+n+" > tbody"));
liveTableData.reset();
});