trouble editing a row
trouble editing a row
I am doing a simple CRUD on datatable because I am new to programming. Everything works perfectly for me except modifying. Can someone enlighten me and tell me why it doesn't work? I'm doing everything according to the bibliography. But at the time of modifying the row is not painting me with the changes and I no longer know what it can be. The worst thing is that it does not give me any type of error or anything
Javascript code fragment where I estimate the problem is~~~~:
if (editar == false) {
//it works perfectly
console.log("Estor entrando a pintanr un fila nueva");
tabla_personas.rows.add([{
"Id": Id,
"nombre": nombre,
"pais": pais,
"edad": edad
}])
.draw();
}
else {
//but this has me on the verge of insanity
tabla_personas.rows(rowIndex).data([{
"Id": Id,
"nombre": nombre,
"pais": pais,
"edad": edad
}])
.draw();
}
editar = false;
This question has an accepted answers - jump to answer
Answers
I think you need to remove the
[]
from the.data()
API. Also you are usingtabla_personas.rows(rowIndex).data([...});
to set the data butrows().data()
only gets data. You need to userow().data()
to set the data, something like this:Kevin
Thanks kevin brother !! I no longer had nails, hair or coffee ... lol