0

Hey I was wondering if anyone could help me with a problem I was having with datatables.

I am trying to create an event listener that will bind to changes in css so that when the width or height changes for the datatable it will activate. This question is the code that I am using Is it possible to listen to a "style change" event? but I cant seem to understand what it is doing or understand why it wont work.

Here is my fiddle. http://jsfiddle.net/2f2L6/2/

(function() {
var ev = new $.Event('style'),
    orig = $.fn.css;
$.fn.css = function() {
    orig.apply(this, arguments);
    $(this).trigger(ev);
}

When I try to change the height of it by displaying more rows I thought that the method would call but it doesn't. Any ideas?

thank you James

Community
  • 1
  • 1
James
  • 557
  • 1
  • 12
  • 29
  • I'm guessing dataTables doesn't really use your custom `css()` method, otherwise it should probably work. – adeneo Mar 20 '14 at 00:43
  • It doesnt work because dataTables not are using `$(element).css()` for changing styles. It would be too slow. I can count to places where it is happening. It uses `.css()` to _read_ style values though. It is very easy to detect page length changes, if that is what you want. – davidkonrad Mar 20 '14 at 12:38
  • Is there an example of the detecting page length changes? would this help with the problem of the datatables changing sizes? – James Mar 20 '14 at 16:50

0 Answers0