How to show hourglass when copy data from one DataTable to another?
How to show hourglass when copy data from one DataTable to another?
gh2m
Posts: 63Questions: 16Answers: 0
I have following javascript which works fine. The issue is that I have to wait to about 7 to 8 seconds to see destinationTable populated. I would like to show users hourglass cursor while waiting. How can that be done?
function selectAll(sourceTable, destinationTable, type){
//add all (from sourceTable) to destinationTable
sourceTable.rows().eq(0).each( function ( index ) {
var row = sourceTable.row( index );
var data = row.data();
destinationTable.row.add(data);
} );
destinationTable.draw();
}
Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide
This discussion has been closed.
Answers
Maybe I shouldn't have used [code]...[/code] around my code. It looks strange. But I guess it is still readable.
Use Markdown as noted when you are entering your post:
I use blockui.js during a long process. Use
$.blockUI();
before the long process followed by$.unblockUI();
when the process is complete.Wonder why the process takes 7 to 8 seconds. Is there a why to improve that time?
Kevin
My table has about 8000 rows and 5 columns. Even if I make a local file and run it from local as C:\Users...., it still take that much time. I have two datatables and the layout are identical. All I am doing it using my javascript function above to copy all the data from source table to destination. Maybe there is a better/faster way to do it?
Following is the table definition and data source, pretty basic:
Also how do I structure $.blockUI() so that it show hourglass while copying/rendering is happening and stop when processing is complete?
I tried following before my copying function but it is not working. My placement of function or blockUI must be off. I have not used this before. Any help is appreciated.
This section of the FAQ should help, it discusses various techniques to improve performance,
Colin
I think this is the code you are using to copy. See if this works:
You can add the message if you wish but the
timeout
shouldn't be needed.You might be able to reduce the number of statements in the loop with
rows().every()
. Something like this:Not sure if this will help the speed much.
Kevin