Moving DataTable controls outside the dataTables_wrapper
Moving DataTable controls outside the dataTables_wrapper
Hello,
I recently discovered DataTables and it's really a great plug-ins !
I need to move some of the controls (pagination & search) outside the DataTables itself. For the search, I just created an input outside, and used the API.
For the pagination, it's a little more complicated to build the component, so I tried just moving the component where I wanted. However, the css style are not working anymore (since the rules are applied to .dataTables_wrapper, I resolved that by doing my own css), and more importantly, the controls are not responding anymore: when I click on a button, it's not doing anything.
Do you have a solution for my problem? Maybe there is a better way of doing what I'm trying to do?
Thx !
Answers
Additional info:
- If I don't move the DataTables_paginate component, it works fine.
- If I move it outside the DataTables_wrapper, it doesn't work after loading the table
- If I do a research into the table (using the search box) after loading, and then try to use the pagination tools, it works fine.
Any ideas of what's causing this problem?
Use a bit of jQuery to move the elements outside of the wrapper. You should do so inside the
initComplete
callback.Allan
Ok thx for the tip, it's working fine now I guess I was moving stuff before the component was entirely built, so it must have cause problems.