如何在数据表中的长度菜单旁边添加选择下拉列表?

我想在长度菜单旁边添加一个自定义下拉filter,如下图所示

我尝试过

var product = 'ConsolesPeripherals'; var config = { "bProcessing": true, "bServerSide": true, "sAjaxSource": "http://localhost/app/get_products", "fnDrawCallback": function() { if($('.dataTables_length').find('#product').length < 1){ $('.dataTables_length').append(product); } }, "fnServerParams" : function ( aoData ) { var type = $("#product").val(); aoData.push({ "name": "type", "value": type }); }, "fnServerParams" : function ( aoData ) { var type = $("#product").val(); aoData.push({ "name": "type", "value": type }); } }; $('#table').dataTable(config); 

下拉列表已插入,但它有很多错误。 它的选定值不是持久的,并且数据表选项更改或分页更改的更改。

实现这一目标的正确方法是什么?