Make Ajax call even on sort?

Make Ajax call even on sort?

motormouthmikemotormouthmike Posts: 7Questions: 0Answers: 0
edited June 2012 in General
Hi

I'm using an ajax variable to populate my datatable. The problem is speed though in Internet Explorer.

In order to get around this, I only display the top 1000 records returned by the users search.

The problem is, that when the user then tries to sort some of the columns, the data is only searching the 1000 records and not the complete dataset.

Is there a function or variable I could set to ensure the new ajax call is made and the information is looked at again?

Alternatively is there a way to disable all search filters as part of a call back function?

[code]
"fnServerData": function ( sSource, aoData, fnCallback )
{
$.getJSON( sSource, aoData, function (json) {
if(json.limitedDataset == 1)
{
fnCallback(json);
alert('Your search with the following filters: ' + filtersMsg+ ' returns ' + json.iTotalDisplayRecords + ' results. Due to technical reasons the display is limited to 1000 records. Please apply additional filters to limit your results further.');

// Update current display
jQuery("#example_info").html(jQuery("#example_info").html() + ' ' + ' of a possible ' + json.iTotalDisplayRecords + ' results.');

// Update future calls via pagination
oTable.fnSettings().oLanguage.sInfoPostFix = ' of a possible ' + json.iTotalDisplayRecords + ' results.';

// How do i set bSort to false at this stage??
oTable.fnSettings().bSort = false;


}
else
{
$('#filters').show();
fnCallback(json);
}
[/code]

Replies

  • motormouthmikemotormouthmike Posts: 7Questions: 0Answers: 0
    I was able to turn off the sort option by doing this:

    [code] jQuery("#example th").attr('class', 'sorting_disabled'); [/code]
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Have you enabled bDeferRender ? That will give a real speed boost in IE.

    Beyond that, you might want to look at server-side processing: http://datatables.net/usage/server-side

    Allan
  • motormouthmikemotormouthmike Posts: 7Questions: 0Answers: 0
    Yes, I already use bDeferRender and server side processing.

    However, my search returns over 2000 records and some include large strings.

    It seems datatables can't handle this in IE 7. Even cutting it down to 1000 records is quite painful.
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    With server-side processing, you should be able to handle many millions of rows without issue. How exactly did you try to implement it?

    Allan
This discussion has been closed.