Toolbar or info bar?
Toolbar or info bar?
glenc2004
Posts: 5Questions: 2Answers: 1
Hello all. I'm new to DataTables and I'm looking to have the date/time of my json data next to the "Show # entries" in the toolbar. I'm not sure if it's possible or what. I'm using the ajax load function to read in the table data. And I would like to display the date & time of that data for the user.
Is this possible? I could put it in the columns but that would would ugly.
Any suggestions welcome!
Thanks!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
This may help:
https://datatables.net/examples/advanced_init/dom_toolbar.html
Something like this might be the best option.
Another option would be to use
language.infoPostFix
, but you'd need to make the Ajax call to get the data yourself, since that option needs to be specified when the DataTable is created.Allan
Thanks Allan and Tangerine for the info. I think I'm going with the infoPostFix. Seems to work for me.
I'm new to Ajax so I'm wondering if someone could point me how to place the returned string(date) into the option. I have the date returning on the file (using alert) but when the DataTables is drawn the variable is null.
So this variable is set outside of the function where the table is created. I'm wondering what the best way to get that variable with the date into the function so it can be used by the infoPostFix option.
Thanks again for all the assistance!
Glen
Ok. Rather than trying to get the variable into the function, I decided to use ajax to change a DIV with the output from the getResponseHeader. I have a feeling the table was being created before the response was being returned from this ajax call. Just printed the table update above the table which is more visible to the user anyway.
Thanks for all your great input!
Really appreciate it.
Glen