Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Datatables : disable first next previous last and show / search record when processing

I am using Datatables 1.9 version

var oTable = $('#example').dataTable( {
        "oLanguage": {"sSearch": "Search all columns:",
                      "sLengthMenu": "Display <select><option value='100'>100</option><option value='200'>200</option></select> records per page"
                     },
        "sPaginationType": "full_numbers",
        "bAutoWidth": false,
        "iDisplayStart": 0,
        "iDisplayLength": 2000,
        "bFilter": true,
        "bInfo": true,
        "bSort": true,
        "sScrollX": "100%",
        "sScrollY": "500px",
        "bScrollCollapse": true,
        "bPaginate": true,
        "bSortClasses": true,
        "bLengthChange": true,
        "bProcessing": true,
        "bDestroy": true,
        "bServerSide": true,
        "bDeferRender": true,
        "fnServerParams": function ( aoData ) {
                aoData.push( { "name": "form_data", "value": data } );
        },
        "sAjaxSource": "search.py",
        "fnServerData": function ( sSource, aoData, fnCallback ) {
                $.ajax( {
                                "dataType": 'json',
                                "type": "POST",
                                "url": sSource,
                                "data": aoData,
                                "success": function (json)
                                {
                                        fnCallback(json);
                                        $('html, body').animate({scrollTop:$(document).height()}, 'slow');
                                        document.getElementById("bottom").focus();
                                },
                                "error": function (xhr, error, thrown) {
                                        alert("An Error Occurred.!");
                                }
                });

The issue is that when I run the search and datatables renders "Processing ..." text the "Show .. Search" and first next previous and last button also gets displayed. Is there a way that I defer there display when datatabales has processed or received response from backend.

like image 238
Programmer Avatar asked Oct 23 '25 17:10

Programmer


1 Answers

You should include "bPaginate": false, into the configuration object you pass to your constructor parameters.

As seen here. as it is data table

like image 108
Anandhukrishna VR Avatar answered Oct 26 '25 06:10

Anandhukrishna VR