2

I'm using Jquery datatables plugin to generate my tables. In every row I have a button to open the child data. The button has the class "fa-plus". To trigger this I use a simple Jquery on click function.

fnDrawCallback: function() {
      $('.fa-plus').click(function() {
           // some functionality
      });
},

This work great only even if you go to the next page it works as the function is reloaled with the fnDrawCallback callback. Only when you use the search option in the dattatables the callback is not triggered. Also not with the fnInfoCallback function.

Does anyone know if there is an callback on the search function of Jequery datatables?

I'm looking for a callback that is triggered on any change of datatables.

1
  • 2
    How are you implementing the search? On my project with dataTables, fnDrawCallback fires every time the table is redrawn after a search is applied. Are you calling draw() on the table? Commented Jul 29, 2016 at 16:29

1 Answer 1

5

You can look at Datatable events

e.g.

$('#table').on('search.dt', function (e, settings) {
    // ...
});

Does that help?

Sign up to request clarification or add additional context in comments.

2 Comments

I just found out a have a other problem, the original function fnDrawCallback works fine as it gives the trigger. But with a search of a sort the row index is changed. Any idee of to get the correct row index?
Get the index when? How? Can you post a code sample?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.