Ajax pagination via server

0

I need to make a pagination via server only via Ajax . Below I'm posting the grid of how I'm doing, but I need to get the dynamic values and I do not know how to do it, follow the grid

function drawTable(habilita) {
dataTable = $('#tabFiltra').dataTable({
    "sPaginationType": "full_numbers",
    "bSearchable": false,
    "bDestroy": true,
    "bRetrieve": true,
    "bServerSide": true,
    "sAjaxSource": "query/getQuery",
    "aoColumns": [{ "bVisible": habilita }, null, null, null, null, null, null],
    "aLengthMenu": [[5, 10, 15, 25, 50, 100, 250], [5, 10, 15, 25, 50, 100, 250]],
    "iDisplayLength": 25,
    "oLanguage": {
        "sProcessing": "Processando...",
        "sLengthMenu": "Mostrar _MENU_ registros",
        "sZeroRecords": "Não foram encontrados resultados",
        "sInfo": "Mostrando de _START_ até _END_ de _TOTAL_ registros",
        "sInfoEmpty": "Mostrando de 0 até 0 de 0 registros",
        "sInfoFiltered": "(filtrado de _MAX_ registros no total)",
        "sInfoPostFix": "",
        "sSearch": "Buscar:",
        "sUrl": "",
        "oPaginate": {
            "sFirst": "«« Primeiro",
            "sPrevious": "« Anterior",
            "sNext": "Seguinte »",
            "sLast": "Último »»"
        }
    },
    "fnServerData": listaPassagensMes(1, 25, 9)

});

}

How do I get this value in the grid:

"iDisplayLength"

And even how do I pass the others without crashing in the code?

    
asked by anonymous 16.05.2014 / 14:43

1 answer

1

So what you can do is set a variable with values coming from an input, select and related something like this:

variavelValor = $('#idCampoAondeVemoValor').val();

"iDisplayLength": variavelValor,

As I said, it's very practical to do, and you do not get caught in the code.

I hope I have helped

    
16.05.2014 / 15:11