I'm loading data via Ajax, but I cannot get MultiSelect filtering to work!
I'm loading data via Ajax, but I cannot get MultiSelect filtering to work!
![Phiph](https://secure.gravatar.com/avatar/d3fc0eb50574f2a7e6f854a32afa96e9/?default=https%3A%2F%2Fvanillicon.com%2Fd3fc0eb50574f2a7e6f854a32afa96e9_200.png&rating=g&size=120)
Hi All,
I am currently loading my data with ajax, which works fine! However I would like MultiSelect filtering on my table, but it just doesn't want to work! I am using ASP MVC hence the @Url.Action
The result only renders 1 select box, which is empty.
Any help would be greatly appreciated.
$('#GetAllCustomers').click(function() {
$.get("/Reports/Table").done(function (result) {
$("#divResult").html(result);
table = $('#example').dataTable({
destroy: true,
"processing":true,
"serverside": true,
"ajax": {
"url": "@(Url.Action("GetAllCustomers", "Reports"))",
"type": "POST",
"dataType": "json",
"dataSrc": ""
},
"columns": [
{
"title": "Account Number",
"data": "AccNumber"
},
{ "title": "account Number", "data": "CustomerAccountName" }
],
"stateSave": true,
"dom": "<'row'<'col-xs-4'l><'col-xs-4 center'T><'col-xs-4'f>r>"
+ "t" +
"<'row'<'col-xs-6'i><'col-xs-6'p>>",
"tableTools": {
"sSwfPath": "\/assets/DataTables/extensions/TableTools/swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "copy",
"oSelectorOpts": { filter: 'applied', order: 'current' }
},
{
"sExtends": "xls",
"oSelectorOpts": { filter: 'applied', order: 'current' },
},
{
"sExtends": "pdf",
"oSelectorOpts": { filter: 'applied', order: 'current' },
"sFileName": "AccountList",
"sPdfOrientation": "landscape",
},
{
"sExtends": "print",
"oSelectorOpts": { filter: 'applied', order: 'current' },
}
]
}
});
$("#example tfoot th").each(function (i) {
var select = $('<select><option value=""></option></select>')
.appendTo($(this).empty())
.on('change', function () {
table.column(i)
.search($(this).val())
.draw();
});
table.column(i).data().unique().sort().each(function (d, j) {
select.append('<option value="' + d + '">' + d + '</option>')
});
});
});
});
This discussion has been closed.