Guys Please help I want to remove Pagination,search , info if there is no data found message display

Guys Please help I want to remove Pagination,search , info if there is no data found message display

Td@12345Td@12345 Posts: 12Questions: 4Answers: 0

Guys Please help I want to remove Pagination,search , info if there is no data found message display

Answers

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    They are disabled when no data, that is not good enough? If not, just use css to hide the controls.

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    add a wrapper around the top and bottom controls:

    $("example").DataTable({
            blah:blah,
         
            dom: "<'dt-top'lf>t<'dt-bottom'ip>",
          blah:blah});
    

    then you can just do this in the most appropriate place

                $(".dt-top").hide();
                $(".dt-bottom").hide();
    

    other options include destroying and rebuilding table with a dom:"t" to hide all of the controls

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin

    There is also a plug-in that was developed by a community member to do this sort of thing, which uses basically the method @bindrid describes.

    Allan

  • Td@12345Td@12345 Posts: 12Questions: 4Answers: 0

    @bindrid I have tried your solution
    $('#AssociatePatientList').dataTable({
    blah:blah,
    dom: "<'dt-top'lf>t<'dt-bottom'ip>",
    blah:blah,
    "language": {
    "lengthMenu": "Display MENU records",
    "info": "Displaying START to END of MAX records"
    }});

    I am getting blah not define.

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    Your kidding right?

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    In case you are, Just take the single line containing the dom:dom: "<'dt-top'lf>t<'dt-bottom'ip>", and add that to your DataTable. so if the above is your entire initialization it would be

    $('#AssociatePatientList').dataTable({
        dom: "<'dt-top'lf>t<'dt-bottom'ip>",
       "language": {
        "lengthMenu": "Display MENU records",
        "info": "Displaying START to END of MAX records"
    }});
    
  • Td@12345Td@12345 Posts: 12Questions: 4Answers: 0

    @bindrid I am not kidding. sorry i am new in datatable

  • Td@12345Td@12345 Posts: 12Questions: 4Answers: 0
    edited May 2017
    var prntTable = $('#PatientReqList').DataTable({
            dom: "<'dt-top'lf>t<'dt-bottom'ip>",
                "language": {
                "lengthMenu": "Display _MENU_ records",
                "info": "Displaying _START_  to  _END_ of _MAX_ records"
            },"aoColumnDefs": [{
                'bSortable': false,
                'aTargets': ['nosort']
            }]});
        
        $
                .ajax({
                    url : "patientReqPending",
                    type : 'POST',
                    dataType : 'json',
                    success : function(data1) {
                        console.log("data :" + data1.length);
                        if (data1.length == 0) {
                            $(".dt-top").hide();
                            $(".dt-bottom").hide();
    
    

    ---------------------Still it shows pagination------------

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin

    Trust me on this one - try the plug-in I linked to above.

    It will save you writing a custom draw callback function, which you would need to do, if you want to show and hide the table controls based on the data in the table on every draw.

    Allan

  • Td@12345Td@12345 Posts: 12Questions: 4Answers: 0

    @allan I will Try It. Can you please give reference URL for implementation Documentation.

  • Td@12345Td@12345 Posts: 12Questions: 4Answers: 0

    I will inform you ance i done with it. Than You Allan

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin

    There is documentation comments with examples in the plug-ins source.

    Allan

This discussion has been closed.