Issue with stateLoadCallback

Issue with stateLoadCallback

dclar43dclar43 Posts: 47Questions: 13Answers: 2
edited March 2017 in DataTables

So, prior to 1.10.13 I'd been persisting states as a way to provide different 'views' for users to choose from. Upgrading to 1.10.13 broke the way I was doing this so I started work on moving it over to use the async support. I ran into a problem where states weren't being loaded properly even though everything looked correct. When I stepped into the callback I found the following issue on line 6314.

You can see that it passes in state even though it's not defined anywhere within the function's scope:

// Without this comment word 'javascript' to the right covers the end of the line below  
var abStateLoad = _fnCallbackFire( settings, 'aoStateLoadParams', 'stateLoadParams', [settings, state] );  

This resulted in an undefined object being passed around in place of a state. Placing the following line directly above that call fixed it, indicating that it should be referring to s instead:

var state = s;

If we go further down to line 6392 where this function(loaded) is actually called you can see that it's even passing in an object called state as the argument s:

if ( state !== undefined ) {
    loaded( state );
}

Unfortunately I don't have the time available at the moment to provide an example, so I'll just ask: Am I overlooking something in the jquery.dataTables.js code or is this an actual bug?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 54,909Questions: 1Answers: 8,606 Site admin
    Answer ✓

    Its a bug. Sorry :-(.

    It was fixed here and the nightly version carries the fix.

    Allan

  • dclar43dclar43 Posts: 47Questions: 13Answers: 2

    Whoops, I missed that when checking the GitHub issues. And no worries, it happens =)

    Thanks for the quick reply as always Allan.

This discussion has been closed.