Serverside data but local sorting, filtering

Serverside data but local sorting, filtering

hostdudehostdude Posts: 7Questions: 0Answers: 0
edited February 2012 in General
I need to be able to load a table via an AJAX call but have the sorting and filtering occur client side. This is because the remote call will also retrieve the full dataset but I don't want the remote server to be hit for sorting and filtering. My initial thought is to hijack the AJAX request, and when it succeeds, to turn off remote retrieval (set bServerSide = false??). Then, when I want to load it again, I simply turn remote retrieval back on. Is there a better way of doing this?

Replies

  • hostdudehostdude Posts: 7Questions: 0Answers: 0
    Well that was simple :). Just needed to set "bServerSide": false.
  • hostdudehostdude Posts: 7Questions: 0Answers: 0
    OK, not quite. This runs the ajax call on page load and will not refresh if I call redraw. So, essentially, what I want is that:

    a) the grid only gets loaded remotely when I request it (basically, when a tab the grid resides on is displayed)
    b) the grid uses the already loaded values for filtering/sorting.

    Any pointers?

    Thanks.
  • hostdudehostdude Posts: 7Questions: 0Answers: 0
    OK, nevermind again. Now i have it working perfectly - I leave bServerSide = false, sAjaxSource = false - this takes care that it does not load when the page loads. Then I run $("#historygrid").dataTable().fnReloadAjax($("table#historygrid").data("target")); whenever I want to refresh it.

    Have I mentioned how great DataTables is?
This discussion has been closed.