Post modificacion datos

Post modificacion datos

MarleneiMarlenei Posts: 2Questions: 1Answers: 0

Me salta este mensaje:
TypeError: Cannot set properties of undefined (setting '_aData')

En las columnas tengo
"columns": [
{
"data": "oProductos", "render": function (data) {
return data.Detalle
},
},
{
"data": "oProveedores", "render": function (data) {
return data.RazonSocial
}
},
{ "data": "Cantidad", },
{ "data": "CodigoId" },
{ "data": "NroExpediente" },
{ "data": "TipoIngreso" },
{"data": "FechaIngreso" },
{"data": "FechaAct1"},
{ "data": "Observaciones" },
{ "data": "NombreyApellido" },

Cuando se modifica los siguientes datos:
$("#txtid").val(json.IdIngreso);
$("#cbodetalle").val(json.oProductos.IdProducto);
$("#cboproveedores").val(json.oProveedores.IdProveedor);
$("#txtcantidad").val(json.Cantidad);
$("#txtcodigoid").val(json.CodigoId);
$("#txtexpediente").val(json.NroExpediente);
$("#txttipoingreso").val(json.TipoIngreso);
$("#txtfechaingreso").val(json.FechaIngreso).prop("readonly", true)
$("#txtobservaciones").val(json.Observaciones);
$("#txtusuario").val(@Session["AccesCode"]);

NombreyApellido viene por IDUsuario. Se envia la BD el Idusuario y en el procedure de listado se realiza un inner join que trae el nombre y apellido del usuario.

Answers

  • MarleneiMarlenei Posts: 2Questions: 1Answers: 0

    Me falto compartirles esto tambien:

    else {
    if (data.resultado) {
    tabladata.ajax.reload(function () {
    tabladata.row(filaSeleccionada).data(Ingresos).draw(false);
    filaSeleccionada = null
    }, false);
    $("#FormModal").modal("hide");

     } else {
         $("#mensajeError").text(data.mensaje);
         $("#mensajeError").show();
     }
    

    }

  • kthorngrenkthorngren Posts: 21,725Questions: 26Answers: 5,027

    I get this message:
    TypeError: Cannot set properties of undefined (setting '_aData')

    In the columns I have

    “columns": [
    {
    “data": ‘oProducts’, ‘render’: function (data) {
    return data.Detail
    },
    },
    {
    “data": ‘oSuppliers’, ‘render’: function (data) {
    return data.ReasonSocial
    }
    },
    { “data”: “Quantity”, },
    { “data”: “CodigoId” },
    { “data”: “NroExpediente” }, { “data”: “NroExpediente” }, { “data”: “NroExpediente” },
    { “data”: “EntryType” },
    { “data”: “FechaIngreso” },
    { “data”: “FechaAct1”},
    { “data”: “Observations” },
    { “data”: “FirstNameandLastName” },
    

    When modifying the following data:

    $(“#txtid”).val(json.IdIngress);
    $(“#cboddetail”).val(json.oProducts.IdProduct);
    $(“#cboproviders”).val(json.oProviders.IdProvider);
    $(“#txtquantity”).val(json.Quantity);
    $(“#txtcodigoid”).val(json.CodigoId);
    $(“#txtexpediente”).val(json.NroExpediente);
    $(“#txtinputtype”).val(json.InputType);
    $(“#txtinputdate”).val(json.DateInput).prop(“readonly”, true)
    $(“#txtobservations”).val(json.Observations);
    $(“#txtuser”).val(@Session[“AccesCode”]);
    

    FirstNameandLastName comes for UserID. The IdUser is sent to the DB and in the listing procedure an inner join is made that brings the first and last name of the user.

    I missed to share this also:

     else {
         if (data.resultado) {
             tabladata.ajax.reload(function () {
                     tabladata.row(filaSeleccionada).data(Ingresos).draw(false);
                     filaSeleccionada = null
             }, false);
             $("#FormModal").modal("hide");
    
         } else {
             $("#mensajeError").text(data.mensaje);
             $("#mensajeError").show();
         }
     }
    

    Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide

  • kthorngrenkthorngren Posts: 21,725Questions: 26Answers: 5,027

    The error indicates a mismatch with the data and the HTML table. It's hard to say what is causing the error without seeing the problem happen. The code snippets don't provide enough information to understand your solution.

    When modifying the following data:

    What is this modifying?

    Please post a link to your page or a test case replicating the error so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

Sign In or Register to comment.