Finally !!!!
Need to declare function on initComplete event. And use search function.
Datatable version 1.11.
$(function() {
var table = $('#DataTable1').DataTable({
proccessing: true,
searching: true,
paging: true,
serverSide: true,
initComplete: function() {
$('.dataTables_filter input').unbind();
$('.dataTables_filter input').bind('keyup', function(e){
var code = e.keyCode || e.which;
if (code == 13) {
table.search(this.value).draw();
}
});
},
ajax: {
url: '@Url.Action("Paginacao")',
type: 'POST'
},
language: {
url: '/plugins/datatables/lang/Portuguese-Brasil.json'
},
columns:
[
{ "data": "id", visible: false },
{ "data": "nome", "autoWidth": true },
{ "data": "cnpj", "autoWidth": true },
{
"render": function(data, type, full, meta) {
return '<a href=@Url.Action("Editar", "Usuario")?id='+full.id+'><b><i class=\"fa fa-edit bigfonts\"></i> Editar</b></a>';
}
}
]
});
});
0 comments:
Post a Comment