Datatables custom filtering with server side

后端 未结 2 1050
谎友^
谎友^ 2021-01-04 13:46

I\'m using DataTables and also using server side processing (Django).

I have a seperate textfield in which I use it to custom filter data in the DataTable after the

2条回答
  •  情歌与酒
    2021-01-04 14:12

    You've almost got it. You just need to assign the filter var to the data parameter that's passed in the datatables request:

    "ajax": {
         "url": "/getdata",
         "data": {
         "friend_name": $('#myselectid').val();
        }
    } 
    

    And to filter the data, just call draw() on the select change event

    $('#myselectid').change(function (e) {
            table.fnDraw();
    });
    

提交回复
热议问题