Server side processing with custom range filtering

Server side processing with custom range filtering

jocapcjocapc Posts: 45Questions: 0Answers: 0
edited May 2011 in General
Hi Alan,

I have a question related to the serverside filterting (I cannot find anything similar on the forum)

I have added multi column filters and combined it with a server side processing. This works fine and in the ajax request are sent parameters sSearch_0, sSearch_1, sSearch_2 as expected. In that case I'm calling fnFilter function and this works fine.

Instead of the simple inputs/select lists I have placed two text boxes as in the Allan's example Range filtering (numbers) on the http://www.datatables.net/plug-ins/filtering. These two inputs (min and max are placed in the footer as a one of the column filters). In that case I'm pushing new function in the $.fn.dataTableExt.afnFiltering and calling fnDraw on key up
$('#max').keyup( function() { oTable.fnDraw(); } );

This works fine in the client-side mode, however in the server-side mode nothing is set in the sSearch_3 parameter.
I cannot directly call fnFilter in this case because I'm using custom range function.

How can I inject sSearch_3 parameter into the ajax request in this case? I would like to pass both variables to the server side in any format like min:max or something else but I don't know how can I add this variable to request - only thing I do is call to the fnDraw function.

Regards,
Jovan

Replies

  • allanallan Posts: 63,538Questions: 1Answers: 10,476 Site admin
    You can send extra parameters to the server (named whatever you want - it can be sSearch_3 if you wish, it doesn't matter as long as the server-side script knows what to do with it), as shown in this example: http://datatables.net/examples/server_side/custom_vars.html

    Allan
  • jocapcjocapc Posts: 45Questions: 0Answers: 0
    That is exactly what I needed. I have modified the code slightly and now it woks fine.

    Thanks,
    Jovan
This discussion has been closed.