Get cell edited previous value
Get cell edited previous value
arasa
Posts: 11Questions: 3Answers: 0
How can I get the original value from the cell, previous submit.
I have been dealing with https://datatables.net/forums/discussion/15981/how-to-get-a-value-from-a-row-on-edit but
console.log( sData[0]);
gives me all the objets. I need the value from this selected cell.
Can anyone help me, or referme to a posible solution?
Ty
**if this question has already been done elsewhere, I apologize, but can't find the answer
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Are you able to give me a link to the page so I can see what software you are using? Also could to clarify when you want to get that data - before the edit, after? What is the goal?
Thanks,
Allan
Thanks Allan, here is a link
I'll send the link to you
i need to pass old and new value from edited cell to salida02.php
thanks a lot
Thanks for the clarification.
There are two options:
1) You could use
modifier()
to get the element that is being edited and then the data from it - for example:However, I would recommend a more robust approach:
2) Get the current value from the database in your
salida02.php
script. Before the data is written to the database you could do a SELECT to get the existing values.Allan
Thanks you Allan
just a consideration:
My 1st bet was the option 2, and it's working 90% of times, but, in some random occasions, looks like my datatables update the db before salida02.php can read the original value and salida02.php read the updated value NOT the original.
I going to test the 1st option... thanks again
for the 2nd option,
how can I stop submit until ajax success?? just to be sure that my SELECT took the date before it's be written to the datatables?
For option 2 I would suggest not having a separate script to get the values! Just have whatever script you are currently using for the edit also get the current values from the database before it does the edit.
If you are using the PHP libraries for Editor, the
preEdit
event will be executed at that point - see the event documentation.Allan