How to add a button at the end of data table display?
How to add a button at the end of data table display?
bench_code
Posts: 14Questions: 4Answers: 0
**
$(".dataTables_wrapper .dataTable").after(`
<button type="button">Arrange</button>
`);
**I have datatable as above picture. If i want to add a button at the end of the datatable view, how do i do it?. I tried above jQuery code and worked well, but button is displayed at every page. Position of my button is ideal instead of no of records showing area(marked yellow) **:
Answers
See if the custom toolbar example helps. If not please provide a test case showing the issue so we can help and offer suggestions.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Custom toolbar helps in my scenario. but, It does displays the toolbar at every page. I don't need that. i need something similar to this image. Button should be displayed at the last page.
Sounds like you need to use
page.info()
to get the total number of pages. Then usepage()
to get the current page. When they match display the button. If not match then make sure the button is removed or hidden. Use these in thepage
event.Kevin