I have a problem here when I try to load these functions in this order:
By the way, I’m using Datatables and jQuery which I am sure many of you probably know already.
currPage = LookupPts.oTable.fnPagingInfo();
LookupPts.oTable.fnReloadAjax();
LookupPts.oTable.fnPageChange(currPage.iPage);
It fails when I try to run fnPageChange() immediately after fnReloadAjax()
I know this is a timing issue due to the asyncronous fnReloadAjax,
My question is how can I have the fnPageChange get called when fnReloadAjax is complete.
You need to implement a callback as Javascript is a non-blocking language and does not work the commands step by step. You therefore need a callback that runs after the method finished.
I just looked at the definition of the ReloadAjax method (I never used this). And if I got the right one which is this: function ( oSettings, sNewSource, fnCallback, bStandingRedraw )) the following code should work: