dataTables crashing iPad
dataTables crashing iPad
fogcity
Posts: 7Questions: 0Answers: 0
dataTables appears to be crashing Mobile Safari on the iPad.
i've got a web app with a dataTable with about 6000 cells. although the sorting and pagination features are pretty responsive, it seems to be overloading the device.
after reloading the page a few times, it eventually crashes Safari. same thing happens when i replace the table contents and redraw the dataTable. or occasionally, when i change the orientation and simply redraw the table with a different height. also, when leaving the page and loading a new page that doesn't contain a dataTable.
without the dataTable code, i can't make the same thing happen under any circumstance.
any chance there's a memory leak here? do i need to clean up allocated memory when the page unloads?
again, each of these things cause crashes:
1. changing the table height:
[code]$('#datatable').fnLengthChange();[/code]
2. re-initializing after replacing all table content:
[code]$('#datatable').dataTable().fnDestroy();
$('#datatable').dataTable();[/code]
3. reloading the page currently loaded:
[code]$(document).ready(function()
{
$('#datatable').dataTable();
});[/code]
4. leaving the page via a link to a page with no dataTable
i've got a web app with a dataTable with about 6000 cells. although the sorting and pagination features are pretty responsive, it seems to be overloading the device.
after reloading the page a few times, it eventually crashes Safari. same thing happens when i replace the table contents and redraw the dataTable. or occasionally, when i change the orientation and simply redraw the table with a different height. also, when leaving the page and loading a new page that doesn't contain a dataTable.
without the dataTable code, i can't make the same thing happen under any circumstance.
any chance there's a memory leak here? do i need to clean up allocated memory when the page unloads?
again, each of these things cause crashes:
1. changing the table height:
[code]$('#datatable').fnLengthChange();[/code]
2. re-initializing after replacing all table content:
[code]$('#datatable').dataTable().fnDestroy();
$('#datatable').dataTable();[/code]
3. reloading the page currently loaded:
[code]$(document).ready(function()
{
$('#datatable').dataTable();
});[/code]
4. leaving the page via a link to a page with no dataTable
This discussion has been closed.
Replies
Allan
actually my table only has 450 rows. each row has 11 columns, so the table has < 5000 cells (not 5000 rows as you seem to be thinking).
i have heard rumors that there is 5 MB memory available to web applications on the iPad. then again, supposedly it's 128 MB. either way, there are zero images involved and my total scripts and other files (not including DataTable) take up less than 100k.
anyway, i have used this exact same setup with the Tablesorter 2.0 plugin for jquery and it works on the same 5000 cells without crashing. so i don't think there is an inherent device limit being hit with my 5000 cells.
i've attached fnDestroy() to $(window).unload() to attempt to unload memory when leaving the DataTables page, but this doesn't seem to help. is there another way i can explicitly free up the Datatables cache and otherwise purge the memory it was using? any other suggestions? i'd really like to use DataTables rather than Tablesorter but first order of business is no crashing the browser...
fnDestory will completely take out anything that DataTables has added, deleting the instance and all it's information with it.
Perhaps try disabling a few features to see if that helps at all, particularly filtering and sorting? See if that makes any difference - but I'm a bit surprised that it crashed at only 450 rows. Bit rubbish that...
Allan
I can send you a URL for testing if you send me your email address. Mine is hookandsling at gmail dot com
Allan
---------------------------------
[url=http://www.ebelow.com/ipad-2-case-iPad2case-iPad-2-cases.html]ipad 2 case[/url]
[url=http://www.ebelow.com/]Apple Accessories[/url]
[url=http://www.ebelow.com/iPad2-cases-cheap-iPad2-cases-iPad2-case.html]iPad2 cases[/url]
Allan
Allan