How can I use the search engine quickly in Server-side processing ?

How can I use the search engine quickly in Server-side processing ?

villasevenvillaseven Posts: 2Questions: 1Answers: 0
edited May 2020 in Free community support

My table consults more than 10 thousand records and requires that it is not paged, when using the search engine, every time I type, it makes the query again and it takes time and I have to wait for the table to load again, but not filter:

dt = $('#example').DataTable({
            "deferRender": true,
            "processing": true,
            "serverSide": true,
            "ajax":{
                "url": "/Tarifas/app/sisTarifasCompleto/consultarTarifasAutorizar",
                "data":{
                    "apartado": 3
                }
            },
            "fnInitComplete": function(oSettings, json) {
                alert( 'DataTables has finished its initialisation.' );
            }, 
            "columns": [
            {
                "class":          "details-control",
                "orderable":      false,
                "data":           "details",
                "defaultContent": ""
            },
            {
                "data": 'titulo'
            },{
                "data": 'check_tarifa'  
            },{
                "data": 'tarifa_propuesta_redondo'
            },{
                "data": 'tarifa_anterior_redondo'
            },{
                "data": 'ruta',
                "charset": "utf-8"
            },{
                "data": 'ruta_propuesta',
                "charset": "utf-8"
            },{
                "data": 'origen_redondo'
            },{
                "data": 'destino_redondo'
            },{
                "data": 'kms_redondo'
            },{
                "data": 'casetas_redondo'
            },{
                "data": 'cuotaxkm_redondo'
            },{
                "data": 'utilidadxkm_redondo'
            },{
                "data": 'tipounidad'
            },{
                "data": 'combustible_actual_redondo'
            },{
                "data": 'combustible_anterior_redondo'
            },{
                "data": 'cdp_redondo'
            },{
                "data": 'litros_redondo'
            },{
                "data": 'ingreso_socio_redondo'
            },{
                "data": 'precio_diesel'
            },{
                "data": 'rendimiento'
            },{
                "data": 'porcentaje_cdp_redondo'
            },{
                "data": 'bono_operador_redondo'
            },{
                "data": 'operador_redondo'
            },{
                "data": 'total_gastos_redondo'
            },{
                "data": 'administracion_redondo'
            },{
                "class": "btnedittf",
                "data": 'boton_editar'
            }
            ],
            "order": [[1, 'asc']],
            "ordering": false,
            "paging": false,
            "searching": false,
            "language": {
                "loadingRecords": "Por favor espere, consultando información...."
            }
        });

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,171Questions: 26Answers: 4,922

    You can try searchDelay. If that doesn't help see if any of the techniques in this thread help.

    Kevin

  • villasevenvillaseven Posts: 2Questions: 1Answers: 0

    Hi @kthorngren!,
    the problem I have is wanting to use the search engine as the data client is used, that based on what I am already looking for, the filter will make me, but the Server-side processing makes the query again and it is not what I am looking for :neutral:

  • kthorngrenkthorngren Posts: 21,171Questions: 26Answers: 4,922
    Answer ✓

    There is not a way to use Server Side Processing and have client side searching. The reason is the only data in the client are the rows being displayed on the page. By definition Server Side Processing implies the server will handle all the processing.

    Kevin

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    You can just remove serverSide - you've disabled paging anyway, so all the data will be on the screen, so there's no value to having it. Then, the search will be client-side as Kevin said.

    Colin

This discussion has been closed.