Modified severSide Mode
Modified severSide Mode

https://datatables.net/manual/server-side
One of the issues with serverSide processing is that you can only search for database values and not for rendered values returned from a getFormatter.
Would it be possible to provide some kind of "hybrid" serverSide processing that searches for server side getFormatter values (if provided) instead of database values? I think this would still be pretty fast - depending on the server of course.
Just to clarify what I mean:
I have a state code in some database field that nobody will ever search for. Everyone will want to search for the state name. Hence I render the state name in a getFormatter on the server. With serverSide the search doesn't work because serverSide is only looking at the database field content which does not contain the state name.
This question has an accepted answers - jump to answer
Answers
The problem is that you need to get all of the values from the database, render and then search them, throwing away the ones you don't want. So yes, it could be done with a custom server-side script, but the benefit of getting the SQL engine to do it all is gone and with it the majority of the speed benefit.
Your best bet with this is to format the data in the SQL and have the search performed on that. Keep as much of the processing as possible in SQL - you only want it to return 10 (or however many) rows, for maximum performance.
Allan
I am aware that some of the speed benefit is gone, but the alternative is extremely cumbersome:
Here is an example of what this can look like. Not nice but I am using it right now.
This is required if you want to use serverSide and be able to search for German and English formatted numbers (e.g. 1.000,00 and 1,000.00) and short notations of those numbers e.g. 1000 or 1000,00 and 1000.00).
In particular "annual_cost_income_german" looks like a nightmare, doesn't it. The formatting with PHP in a getFormatter is much simpler.
While I agree that some of the benefit would be sacrificed I think that there should still be a speed benefit working with rendered values on the server. In many use cases this should be fast enough, don't you think?
I'm not familiar with the PHP scripts but possibly you can create a deformatter, for the desired fields, to revert the search term back to the original source value. Not sure how easy or if possible this would be.
Kevin
Tried that, too. I converted the user entries to the database format before sending the search values to the server. It was even more cumbersome. And not really workable if you have many rendered fields.
Here is an example of a "deformatter" that I dismissed a while ago to implement the server side views above.
You see how complex this can be - hence I found it was worse than the SQL approach. You need to make sure you are only converting the right entries e.g. dates and not mistakenly convert a number, for example.
It would be really interesting to do an analysis of this. It might be a good project for a summer student... My gut feeling is that doing server-side processing with all the data being read into the script (PHP, .NET, whatever), being parsed and filtered there, will not offer any significant improvement over client-side processing, up to a cross over, when the initial load time becomes unsuitably long.
Doing it all in SQL would be preferable, but as you say, it can quickly get ugly (and ugly SQL often isn't particularly performant itself!).
I'll have a bit of a think about this and maybe that is some research that is worth doing.
Allan