Changed to server-side sAjaxSource. Now I lost filtering?
Changed to server-side sAjaxSource. Now I lost filtering?
mvelasquez
Posts: 17Questions: 0Answers: 0
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]
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]
This discussion has been closed.
Replies
When I click the table column headers, my arrow changes direction, but the row sorting doesn't change.
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?
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
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 :)