Adding Datatable Lines

Asked

Viewed 105 times

0

I have a table, which I need to fill out dynamically, as the user adds the information. How can I get this information, I already have the function that picks it up, and add it to Datatable ? Follow the function I get the fields filled:

 function Adicionar() {
    var url = "/PedidoFornecedor/Adicionar";
    var ProdutoID = $("#produtoid").val();
    var CodigoProduto = $("#idproduto").val();
    var Qtd = $("#qtd").val();
    var PrecoCusto = $("#precocusto").val();
    var DescontoV = $("#descontov").val();
    var DescontoP = $("#descontop").val();
    var ICMS = $("#icms").val();
    var AliquotaICMS = $("#aliquotaicms").html().replace("%", "");
    var IPI = $("#ipi").val();
    var ISS = $("#iss").val();
    var PedidoID = $("#pedidoid").val();
    var DataEntrega = $("#dataentrega").val();
    $.ajax({
        url: url,
        data: {
            produtoid: ProdutoID, codigoProduto: CodigoProduto, qtd: Qtd, precoCusto: PrecoCusto,
            descontoV: DescontoV, descontoP: DescontoP, icms: ICMS, aliquotaICMS: AliquotaICMS,
            ipi: IPI, iss: ISS, dataEntrega: DataEntrega, pedidoID: PedidoID
        },
        datatype: "json",
        type: "POST",
        success: function (data) {
            if (data.resultado) {
            }
        }
    })
}

How can I include in Datatable ?

  • calling a function that fetches the data again would not solve the problem ?

  • Loading the datatable you speak of?

  • This, would call him again, theoretically the table would receive the data that has just been registered.

  • But it is not being registered in the database, not yet, I need to send the data, and only later when the user click on another save button.

  • Oh yes, you can post the datatable structure?

  • @Lucasbrogni there that I do not know, because I use . NET CORE, if you have some example to help me.

  • 2
Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.