Is it possible to filter the table before showing it?
Is it possible to filter the table before showing it?
I have a huge table with more than 20 columns and hundreds or thousands of rows (with hidden tooltips, data attributes and plenty of classes. Pagination is not wanted and filtering takes a few seconds sometimes (5 - 8) in a fast computer.
I noticed datatables is showing the table (rendering it on the browser), and then filtering it. Wouldn't it be possible to filter it inside the Javascript object instead of working directly width the doom?
I've been trying to use the "bStateSave" option but it doesn't seem to work. Also, it is not very well documented and I don't really know if it would save the state of all the table (with the exact same classes and tolltips it had before the reload of the site) or only its structure. I say this because after every filter I apply on the table I'm modifying the table classes and looping throw the rows to check some things.
Therefor, I am soing something like this now to remember the state after a page refresh:
[code]
$.post("http://"+ document.domain +"/getSessionAjax.json", function(dat){
if(dat['result']){
tablePlugin.fnFilter( '' , i);
tablePlugin.fnFilter('agreed', 18);
//modifying classes over the resulting rows.
myOperationsOverTheTable();
}
});
[/code]
This causes the table to show all the data and proceed with the filter once the DOM is ready, which makes it slower as it has to render twice. (and the first time is a huge render)
I noticed datatables is showing the table (rendering it on the browser), and then filtering it. Wouldn't it be possible to filter it inside the Javascript object instead of working directly width the doom?
I've been trying to use the "bStateSave" option but it doesn't seem to work. Also, it is not very well documented and I don't really know if it would save the state of all the table (with the exact same classes and tolltips it had before the reload of the site) or only its structure. I say this because after every filter I apply on the table I'm modifying the table classes and looping throw the rows to check some things.
Therefor, I am soing something like this now to remember the state after a page refresh:
[code]
$.post("http://"+ document.domain +"/getSessionAjax.json", function(dat){
if(dat['result']){
tablePlugin.fnFilter( '' , i);
tablePlugin.fnFilter('agreed', 18);
//modifying classes over the resulting rows.
myOperationsOverTheTable();
}
});
[/code]
This causes the table to show all the data and proceed with the filter once the DOM is ready, which makes it slower as it has to render twice. (and the first time is a huge render)
This discussion has been closed.