Adding span to TD really slow things down in DOM creating table
Adding span to TD really slow things down in DOM creating table
Do: Use the DataTables debugger:
http://debug.datatables.net/oxuhid
Description:
I generate additional HTML markup in every td. Example bellow:
tempHtml += ''+jQuery(this).attr('name')+' '+jQuery(this).attr('description')+''
Problem:
When I add to the HTML it really slow things down, like 18 seconds for 20 rows.
Test case:
You can try to add:
tempHtml = 'test
or
tempHtml = 'test
and then use your fnAddTr plug-in. You will see the speed difference.
http://debug.datatables.net/oxuhid
Description:
I generate additional HTML markup in every td. Example bellow:
tempHtml += ''+jQuery(this).attr('name')+' '+jQuery(this).attr('description')+''
Problem:
When I add to the HTML it really slow things down, like 18 seconds for 20 rows.
Test case:
You can try to add:
tempHtml = 'test
or
tempHtml = 'test
and then use your fnAddTr plug-in. You will see the speed difference.
This discussion has been closed.
Replies
Allan
I cannot link you the the page, as this is an internal web application which needs C# service in order to work.
Please let me know if I can help you debug in any other way.
Cheers,
Rok Meglič
did you have time to look into this? Thank you!
Cheers,
Rok
is this error not under "free support" and we need to purchase your time? No problem, just let me know.
Cheers,
Rok Meglič
For example, how are you using fnAddTr? Is it in a loop? If so, are you telling it to not redraw on every addition?
Allan
Yes, it is in the loop and the parameter for redraw is false.
You can check the "API: plug-in methods" from debug URL: http://debug.datatables.net/oxuhid .
As I said. The problem only occurs if you add to the HTML.
Another option is to consider using DataTables 1.10 which has the ability to add TR elements built into its new API - `row.add( ... )` will accepts a node, object or array.
Allan
As I said you can easily test this with:
tempHtml = 'test
and then user your plugin fnAddTr .
With span: http://live.datatables.net/igocuk/2/edit - no real difference that I can see.