How does Editor calculate value based on other data in DataTable?
How does Editor calculate value based on other data in DataTable?
saligiayys
Posts: 12Questions: 7Answers: 0
Hi team,
I have a DataTable with start-time, end-time and worked hours.
How should I use Editor to enter or edit start-time and end-time to get the value of worked hours then render these three data in the table? Cold you please advise?
Thank you very much!
This question has an accepted answers - jump to answer
Answers
Just take a look at the examples. You'll find lots of similar use cases there as well.
https://editor.datatables.net/examples/index
In your case you could send start and end time to the server. Calculate the worked hours on the server, have Editor do the database insert or update and have Editor reload the updated values including hours worked to the client. That would all happen automatically.
You could also do the calculation on the client side but I wouldn't do it if you need to save the values in a database anyway.
On the server side your Editor fields could look like this - assuming your wire format is the usual SQL-datetime format.
Thank you very much! I will read all the documents again.