Changed to server-side sAjaxSource. Now I lost filtering?

Changed to server-side sAjaxSource. Now I lost filtering?

mvelasquezmvelasquez Posts: 17Questions: 0Answers: 0
edited January 2011 in General
I'm using datatables.net with ASP.NET MVC and it's been all right so far.
some issues here and there.

i pass my list of objects through ViewState, spin through those objects client side to create rows in my HTML table, then convert it to datatables.net table.

That proved to be far too cumbersome when I started dealing with 1500+ rows.
So I changed to server-side, using sAjaxSource.
This cut down my wait time by over 50%, but now for some reason I've lost filter capability.

The only thing I changed was my table initialization to use sAjaxSource and bServerSide.

Now when I type in the filter box, it does attempt to filter, but when all is done, it keeps the same contents in the table.
It doesn't filter it at all.
[code]
vTable = $('#vendorItems').dataTable({
"aoColumns": [
{ "sTitle": "Id" },
{ "sTitle": "Name" },
{ "sTitle": "City" },
{ "sTitle": "State" }
],
"bPaginate": false,
"bLengthChange": false,
"bProcessing": false,
"bServerSide": true,
"sAjaxSource": "/KTClient/Tag/GetJSONVendorList/1?companyName=" + $('#companyNameHiddenFieldValue').val()
});
[/code]

Replies

  • mvelasquezmvelasquez Posts: 17Questions: 0Answers: 0
    Btw, I also lost functionality of sorting.
    When I click the table column headers, my arrow changes direction, but the row sorting doesn't change.
  • mvelasquezmvelasquez Posts: 17Questions: 0Answers: 0
    no answers?
    i assume that converting to server-side you need to now support your own filtering/sorting?

    is there a tutorial or sample code in C# that does this?
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Yes indeed you need to have the filtering and sorting implemented on the server-side for it to be done. With server-side processing DataTables is really just an event and display handler - there is little processing which actually happens.

    There are a number of server-side implementations here: http://www.datatables.net/development/server-side/ - including .NET, there have also been a few articles written by the community to show how it can be done (I've tried to link them from here: http://datatables.net/news.php - for example http://activeengine.wordpress.com/2010/12/19/how-to-create-server-side-paging-for-datatables-net-with-asp-net/ ).

    Allan
  • mvelasquezmvelasquez Posts: 17Questions: 0Answers: 0
    thank so much allan for your response.
    i was able to implement both filtering and searching server-side.

    my next issue is with the click handlers on the rows.
    i'll start a new topic for that though. thanks :)
This discussion has been closed.