Hey all,
I'm running into a strange issue, and it's happening across a few sites I maintain that use datatables.
Whenever I utilize fnPageChange, it does not work unless there is a setTimeout around it like this;
or with an alert before it
I understand this may be a sequence error of some sort, but I'm just unsure why the same issue would arise across multiple projects.
Here is the delete function I'm working with now:
Does anyone know what the issue is?
I'm running into a strange issue, and it's happening across a few sites I maintain that use datatables.
Whenever I utilize fnPageChange, it does not work unless there is a setTimeout around it like this;
setTimeout(function() { oTable.fnPageChange(whatPage); }, 100);
or with an alert before it
alert('starting'); oTable.fnPageChange('last');
I understand this may be a sequence error of some sort, but I'm just unsure why the same issue would arise across multiple projects.
Here is the delete function I'm working with now:
function fnDelete(elem){ if (selected.length>0) { var c; c = confirm('Are you sure you want to delete the selected ${displayTableName}?'); if (c) { // Create delete url from editor url... var deleteURL = (urlstr.substring(0, urlstr.lastIndexOf('/') + 1)) + "delete.do"; deleteRecord(deleteURL,selected[0]); if ( $('tableViewer tr').length === 0) { // Reload the Table oTable.fnPageChange('last'); //Send them back to the last page } } } }
Does anyone know what the issue is?