Individual column filtering (using input and select menus) - server side

Individual column filtering (using input and select menus) - server side

valmellovalmello Posts: 27Questions: 4Answers: 0
edited April 2014 in General
Olá a Todos!

É possível carregar os dados do filtro select a partir dos dados do lado servidor?
Até que consegui fazer este carregamento colocando "bServerSide": false e aoColumns: [ { type: "select" } ] porém o carregamento fica super lento.
Alguém pode me dizer se é possível ou não. E se possível informar como devo proceder?

Abaixo o meu código...

Abraços...


[quote]

var oTable = $('#dt_basic').dataTable({
"sPaginationType" : "bootstrap_full",
"iDisplayLength": 10,
"aLengthMenu": [[10, 30, 50, 70, 99], [10, 30, 50, 70, 99]],
"bAutoWidth": false,
"bSortCellsTop" : true,
"aaSorting":[[0, "desc"]],
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0,6,8 ] },
{ "sClass": "center", "aTargets": [ 0,1,2,3,4,5,6,7,8,9,10 ] }
],
"oLanguage": {
"oPaginate": {
"sFirst": '',
"sPrevious": '',
"sNext": '',
"sLast": ''
},
"sInfoThousands": ".",
"sZeroRecords": "Nada foi encontrado - desculpa",
"sInfo": "_START_ a _END_ de _TOTAL_ registros",
"sInfoEmpty": "Mostrando 0 até 0 de 0 registros",
"sInfoFiltered": "(filtro a partir de _MAX_)",
"sProcessing": "Aguarde..."
},
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "php/server_processing.php",
"fnServerData": function( sUrl, aoData, fnCallback ) {
$.ajax({
"url": sUrl,
"data": aoData,
"success": fnCallback,
"dataType": "json",
"cache": false
});
},
"sDom" : "<'dt-top-row'Tlf>r<'dt-wrapper't><'dt-row dt-bottom-row'<'row'<'col-sm-6'i><'col-sm-6 text-right'p>>",
"oTableTools" : {
"aButtons" : [{
"sExtends": "text",
"sButtonText": " Limpar",
"fnClick": function ( nButton, oConfig, oFlash ) {
var oSettings = oTable.fnSettings();
for(iCol = 0; iCol < oSettings.aoPreSearchCols.length; iCol++) {
oSettings.aoPreSearchCols[ iCol ].sSearch = '';
}
oTable.fnDraw();
$("#dt_basic :input").each(function(){
$(this).val('');
this.style.color = "#999";
});
}
},{
"sExtends": "copy",
"sButtonText": " Copiar",
},{
"sExtends" : "collection",
"sButtonText" : ' Salvar ',
"aButtons" : [{
"sExtends": "download",
"sButtonText": "Excel",
"sUrl": "php/generate_csv.php"
}],
}
],
"sSwfPath" : "js/plugin/datatables/media/swf/copy_csv_xls_pdf.swf"
},
"fnInitComplete" : function(oSettings, json) {
$(this).closest('#dt_table_tools_wrapper').find('.DTTT.btn-group').addClass('table_tools_group').children('a.btn').each(function() {
$(this).addClass('btn-sm btn-default');
});
}

})

.columnFilter({
sPlaceHolder: "head:after",
aoColumns: [
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" }
]

});


[/quote]
This discussion has been closed.