Defer loading cached array data client-side.

Defer loading cached array data client-side.

kingrichard2005kingrichard2005 Posts: 7Questions: 0Answers: 0
edited July 2011 in DataTables 1.8
Hello, I'm building a table using an array object containing about 200+ rows of data (or 200+ arrays of data) that is stored in the browser cache as the comments in the code snippet bellow describe. As it is, the page takes too long to load, my challenge is as follows:

[quote]The data table needs to know in advance how many elements there are in the 'resultSet' array so pagination shows the correct number of pages, but it must only populate the page that is currently being viewed, otherwise initial page load takes too much time.[/quote]

[code]
/*
* Builds the measurement table using column names and result set
*/
function buildTbl(colNames, resultSet){
//Construct the table framework
$(colNames).each(function(){
$('#measTable thead tr').append('' + this + '');
});

//Prepare the measurement table
data_table = $('#measTable').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bProcessing": true
});

$('#measTable').data('resultSet', resultSet);//Store data for later use

/*
* Dynamically add the result set data to the table.
* TODO: This takes too long, alternative needed
*/
$(resultSet).each(function(){
data_table.fnAddData([this]);
});
}
[/code]

I've been trying to find a way to accomplish this, I'm not sure if DataTables has a way of doing this already. Any help is appreciated.

UPDATE:
Sorry, to clarify, the 'resultSet' is an array of arrays, e.g. resultSet[0] = array[9]


UPDATE 2:
This issue has been resolved in another post. Please see [quote]http://datatables.net/forums/discussion/comment/22689#Comment_22689 [/quote] Thank you
This discussion has been closed.