_fnProcessingDisplay() displaying only after leaving calling method

_fnProcessingDisplay() displaying only after leaving calling method

mbroadbearmbroadbear Posts: 1Questions: 0Answers: 0
edited October 2013 in General
I have two tables, and I want to transfer selected rows between them. I would like the processing message to appear on both tables until the transfer is complete.

To accomplish this, I created the below 'plugin' method, but the processing messages on the src table does not display until AFTER the method returns, and the processing message on the dest table does not display at all. I have also tried setting css visibility manually (commented out below), but the processing messages also do not display until after the method returns.

What's going on?

[code]
$.fn.dataTableExt.oApi.fnTransferSelectedRows = function(settings, $destTable) {
// $(".dataTables_processing").css('visibility','visible');
this.oApi._fnProcessingDisplay(settings, true);
$destTable.oApi._fnProcessingDisplay(settings, true);

var srcTblInstance = new TableTools(this);
var selectedRows = srcTblInstance.fnGetSelected();
var selectedRowData = srcTblInstance.fnGetSelectedData();
for (i = 0; i < selectedRows.length; i++) {
var deletedRow = this.fnDeleteRow(selectedRows[i], null, false);
}
this.fnDraw(false);
var indexes = $destTable.fnAddData(selectedRowData);

// $(".dataTables_processing").css('visibility','hidden');
// this.oApi._fnProcessingDisplay(settings, false);
// $destTable.oApi._fnProcessingDisplay(settings, false);
}
[/code]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You probably need to put in a setTimeout to break the Javascript 'thread'. I suspect the browser is trying to group display invalidations to minimise draw time.

    Allan
This discussion has been closed.