monkey patching datatables function

monkey patching datatables function

hpachecohpacheco Posts: 19Questions: 0Answers: 0
edited April 2011 in General
Hi,

I was trying to monkey patch _fnUpdateInfo

[code]
function monkeyPatchTableInfo() {
$.fn.dataTable.prototype._fnUpdateInfo = function (oSettings) {
alert();

}
};
[/code]

Like this, but apparently that doesn't work as dt won't use the new function. I think I'm not looking for the function in the right place - $.fn.dataTable - but I have no clue on where it is defined.

Help would be appreciated :-)

Cheers,
Hugo

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin
    The current method of implementation that DataTables uses makes _fnUpdateInfo a private function and thus cannot be overridden externally. You would need to modify the source if you wanted to override it.

    There is fnInfoCallback - http://datatables.net/usage/callbacks#fnInfoCallback - which might be of interest to you if you haven't looked at it already.

    Allan
  • hpachecohpacheco Posts: 19Questions: 0Answers: 0
    Oops, totally missed that. I think fnInfoCallback will do the job as I didn't want to modify the core because it would be to much trouble to update to newer versions

    Thanks Allan!
This discussion has been closed.