Query execution time
Query execution time

I want to display SQL execution time somewhere on my datatable.
I've added a duration value to the JSON output:
"{"duration":"6.1875","data":[{.....
I've had a look through the API if there's a way to overide the info display or append it, but cannot see.
This question has accepted answers - jump to:
This discussion has been closed.
Answers
You can use
infoCallback
for that, usingajax.json()
to get the last Ajax response.Colin
brilliant, got it working. Thanks very much
@neburton,
I got working evaluating the json object and adding it into the infocallback as @colin mentioned.
May I ask how you added the duration value to the JSON output?
I guess, you are counting the time as decribed here somehow, but I have no clue, how to this.
Thank you
@tefdat - It will depend on what you are using at the server-side to build the JSON. Your code above makes it look like
data.json
is a static file, but it might be getting parsed dynamically by something?Allan
Hey @allan
meanwhile I got it already almost running (without integrating into the json) - thx to the great datatables API docs
Only Issue - preXhr.dt is fired only once at page refresh, not again - allthough everything else running well.
I used the workaround the preDraw event - pretty same result. Its perfect now.
Thank you all.
This is an important information for the user, hence pushing F12 and looking into the console is too much for the most of em
Nice one - thanks for posting back!
Allan