[note: the following answer is for DataTables 1.9x and below. 1.10 changed method naming conventions and a few other things. 1.9x methods are available but outdated and will inevitably be removed completely.]
If itβs safe to strip them of βwholesaleβ (that is, if you create an escape line function that does not affect JSON fairness), you can do this using the fnServerData function:
"fnServerData": function ( sSource, aoData, fnCallback ) { $.ajax( { "dataType": 'json', "type": "GET", "url": sSource, "data": aoData, "success": function (data) {
If you are not sure about the safety of changing his wholesale business, you can do this in turn, line by line, using fnRowCallback:
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { var cellData = myEscaper(aData[0]);
In this example, I only change the first cell. If this applies to all cells, you probably want to write an iterator that will go through the entire line to do the conversion. If this applies only to some cells, you can process them one at a time.
Note that aData [0] and td: eq (0) only match the same index (0). If you have hidden columns, there will not necessarily be a match. Also, if you are using mDataProp, you will also need to handle this.
Greg pettit
source share