Defer loading with bServerSide as 'false'.
Defer loading with bServerSide as 'false'.
So, I have a table that I wish to populate with data from an AJAX source, but wish to use client-side sorting only. However, I also wish to defer the loading until I trigger it within an event callback (When a user clicks a button.) But this doesn't seem to work.
[code]
$profilesTable.dataTable({
sAjaxSource: Globals.base_url + '/accounts/ajax_list_profile_source',
iDeferLoading: 0,
bServerSide: false,
aaSorting: [[4, 'desc']],
fnServerParams: function(data){
var currentAccount = $(this).data('currentAccount');
if(currentAccount != null){
data.push({name: 'account_id', value: currentAccount});
}
}
});
[/code]
I tried turning bServerSide to 'true', which causes the XHR request to be deferred, but it is really imperative that I use client-side sorting.
How can I achieve this?
[code]
$profilesTable.dataTable({
sAjaxSource: Globals.base_url + '/accounts/ajax_list_profile_source',
iDeferLoading: 0,
bServerSide: false,
aaSorting: [[4, 'desc']],
fnServerParams: function(data){
var currentAccount = $(this).data('currentAccount');
if(currentAccount != null){
data.push({name: 'account_id', value: currentAccount});
}
}
});
[/code]
I tried turning bServerSide to 'true', which causes the XHR request to be deferred, but it is really imperative that I use client-side sorting.
How can I achieve this?
This discussion has been closed.
Replies
So currently, iDeferLoading requires server-side processing, not client-side. This might change in future, but I'm not sure I see a huge advantage in it since, as I say, you'd need to reimplement the first sort on the server. However, patches / pull requests for this are very welcome.
Allan
I understand.
However is there a way to effectively delay the fetching of the data until a certain trigger, given that I wish to use client-side only?
(Back-story: My data is being stored in such a way that sorting server-side is resource-heavy. This is why I require this particular behavior. And the reason why I want the initial loading deferred is that the server call requires a set of parameters that I mine from a form in the page. Until the form is filled up and ready, then I'd like the DataTable to fetch.)
Regards,
Alel
Allan