Moving DataTable controls outside the dataTables_wrapper

Moving DataTable controls outside the dataTables_wrapper

z4kn4f3inz4kn4f3in Posts: 3Questions: 1Answers: 0

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

  • z4kn4f3inz4kn4f3in Posts: 3Questions: 1Answers: 0

    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?

  • allanallan Posts: 63,815Questions: 1Answers: 10,517 Site admin

    Use a bit of jQuery to move the elements outside of the wrapper. You should do so inside the initComplete callback.

    Allan

  • z4kn4f3inz4kn4f3in Posts: 3Questions: 1Answers: 0

    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.

This discussion has been closed.