Help with scollx / draw() error

Help with scollx / draw() error

bitbucketbitbucket Posts: 2Questions: 1Answers: 0

I am getting "Cannot read property 'style' of undefined " when I call draw() when "scrollx" is enabled. I am hoping someone can tell me what I am doing wrong...

Here is a fiddle that demonstrates the problem: http://jsfiddle.net/KSz3Z/. Press the "test" button to get the error

However, I get no error if I change this:

       $("#my-button").click(function () {
            $('.my-dt-class').each(function () {
                $(this).DataTable().draw();
            });
        });

to this:

$("#my-button").click(function () {
        $("#my-dt-id").DataTable().draw();
});

Here is a fiddle for the successful case: http://jsfiddle.net/tt93e/

This code is scaled-down just to show the problem. In my real code, I have a variable number of different types of tables on the page. I want to be able redraw a particular type of table based on user input, so I would really like to be able to use the class name selector. I also want to keep the scollx enabled. Any idea what I am doing wrong?

Answers

This discussion has been closed.