fnInfoCallback
fnInfoCallback
DataTables has a callback named "fnInfoCallback". At first I thought this would be the equivalent of a "onFilterCallback" (actions to take every time a filter is applied) - but I found that this callback *only* works if the sDom property includes the filter input. (To get around this I applied a class in the sDom property to make it invisible).
Basically, I'd like to be able to display the table information somewhere other than in Datatables generated elements (I think many others would like to do this too.) While you can do this by using the "fnInfoCallback", it seems illogical to me that you need to hide the filter input in order to do this. Is this a bug by any chance? (Was it intended to work this way?) Could this be something addressed in a future version?
Basically, I'd like to be able to display the table information somewhere other than in Datatables generated elements (I think many others would like to do this too.) While you can do this by using the "fnInfoCallback", it seems illogical to me that you need to hide the filter input in order to do this. Is this a bug by any chance? (Was it intended to work this way?) Could this be something addressed in a future version?
This discussion has been closed.
Replies
Phew - you had me worried for a second there :-).
This is working exactly the way it was intended - the callback is there specifically to modify the text that will be shown in the information display. If you aren't showing the text, why would you need the callback to modify said text?
If you want something to occur on each draw, there is fnDrawCallback available.
Allan
<
The DataTables API with the advent of v1.10 will include this kind of information in the built-in public API :-)
Fair point about using the info callback to populate some other element. That sounds like a good reason to make the required change to me (note made for inclusion in 1.10 - there will just be an `if` condition).
Another option might be to move the DataTables controlled info element to somewhere else in the DOM after the table has initialised. Not really a common thing to do, but it is possible.
Allan