Filter with external form with jquery datatables

1

I'm trying to make an external filter from an external form

Until then, for a simple generic search, jquery datatables uses the parameter 'sSearch'

For this, I just do

  var grid = new $.fn.dataTable.Api('.e-grid');
  grid.search('Teste');
  grid.draw();

All right, but I need to make a somewhat more complex filter, which the filter form data is not in the column. I'm talking about this, because every more complex filter that I found to be an example was just the columns that already existed in the datatable

The question is, how do I pass other parameters to this filter? besides the default that is sSearch

NOTE: The filter is via Ajax , and as Server Side I am using Asp.net MVC

    
asked by anonymous 14.04.2015 / 13:57

1 answer

1

Here is an example below:

var oTable = $("#dataTableCustom").dataTable({
        "iDisplayLength": 25,
        "bDestroy": true,
        "bProcessing": true,
        "bJQueryUI": true,
        "bAutoWidth": false,
        "bServerSide": true,
        "sAjaxSource": globalSource,
        "sPaginationType": "full_numbers",
        "fnServerData": function (sSource, aoData, fnCallback) {
            $.getJSON(sSource, aoData, function (json) {
                var parsedJSON = $.parseJSON(json);
                fnCallback(parsedJSON)
            });
        },
        "fnServerParams": function (aoData) {
            aoData.push({
                "name": "listName",
                "value": wcfListName
            })
            aoData.push({
                "name": "columnNames",
                "value": wcfColumnsToDisplay
            })
            aoData.push({
                "name": "SortingDirection",
                "value": wcfSortDirection
            })
            aoData.push({
                "name": "sortingColumns",
                "value": wcfSortColumns
            })

        }
    });

Value of value can be an imput too, eg

"value": $(".meuiinput").val();

The above example was taken from this LINK , of Jquery DataTables

    
20.04.2015 / 20:27