Draw not fired on fnAjaxReload / Ajax.Reload / __reload

Draw not fired on fnAjaxReload / Ajax.Reload / __reload

renekrenek Posts: 1Questions: 1Answers: 0

Hey guys,

I just have the curios issue that the draw event isn't allways fired when I reload my table.

Here is my table init:
mCommissionTable = $("#CommissionTable").dataTable({
"bJQueryUI": false,
"sDom": 'lfrtip',
"columns": [
{ "data": "CommissionId" },
{ "data": "Description" },
{ "data": "CommissionTypeDisplayName" },
{ "data": "DivisionCode" },
{ "data": "EmployeeName" },
{ "data": "EmployeeNumber" },
{ "data": "PeriodFrom" },
{ "data": "PeriodTill" },
{ "data": "ApprovalStatusDisplayName" },
{ "data": "StatusDisplayName" },
{ "data": "Comment" }
]
});

Here is my Refresh:
function onButtonClickA() {
mCommissionTable.fnReloadAjax("GridCommunication.aspx?do=GetCommission" + mFilter, RefreshSelectedRows);
}

Here is the RefreshSelectedRows:
function RefreshSelectedRows() {
alert('fired!');
}

So everything works fine, table will not be loaded until I click the button the first time, everystime I click the button the table will be loaded.
But in fact the callback (RefreshSelectedRows) is not fired every time.

In the DataTables.js code I found the __reload-method in which the API register the callback-event one time, Line 7140:

    if (callback) {
        var api = new _Api(settings);

        api.one('draw', function () {
            callback(api.ajax.json());
        });
    }

When I track it to that with Visual Studio and set breakpoint the Api,one-command will be hit with 100%, so it is registerred.
The callback isself (what only happens when the event is fired) get hit randomly.
I can't reproduce it. it just happened. I click 20 times on the button, 15 times it is okay, 5 times not...

I tried to track it down, but as far as I can see in the _fnReDraw method, where the fnDraw is called and the draw event in triggered everything is okay...

So... bug?

Any ideas?

This discussion has been closed.