Calling fnClose() in fnPreDrawCallback() results in error

Calling fnClose() in fnPreDrawCallback() results in error

JordanEmbryJordanEmbry Posts: 1Questions: 0Answers: 0
edited April 2012 in Bug reports
I found an issue where calling fnClose() in fnPreDrawCallback() will throw an error on the current draw (calling fnOpen() will not likely work like intended either). The issue is that in function _fnDraw the variable iOpenRows is set and populated before the call off to the PreDraw callback.

Sample test code:
[code]
"fnPreDrawCallback": function()
{
if(objDataTable != null)
{
$(objDataTable.fnGetNodes()).each(
function(index)
{
if(objDataTable.fnIsOpen(this))
{
objDataTable.fnClose(this);
}
}
);
}
}
[/code]

The fix is simple, make the PreDraw callback before declaring the block of variables at the top of _fnDraw. Here is a link to a patch file if you're interested http://queryminer.com/predrawfix.patch (based off of 1.9.1).

Replies

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Good point! Thanks very much for:

    1. Finding this
    2. Reporting it
    3. Fixing it

    :-D

    I've just committed your fix and its available in 1.9.2.dev (the current nightly) on the downloads page: http://datatables.net/download .

    Regards,
    Allan
This discussion has been closed.