Search code examples
javascriptjqueryuser-interfacedatatablesjquery-pagination

Data Table: How to show the show Entries dropdown beside the Showing 0 to 0 of 0 entries in the table structure


Is it Possible to show the show Entries dropdown beside the Showing 0 to 0 of 0 entries in the table structure.I want to display the show entries dropdown at the bottom along with pagination and Showing 0 to 0 of 0 entries.

Thanks in Advance!!!

The image is looking like

Now I want to show the show dropdown entries as per second scenario.

the image is with show dropdown at top

Now i want to show the show dropdown entries as per the image two.


Solution

  • Yes, it is possible through dataTables "dom"-attribute. i is info, l is lengthmenu, insert l just before i :

    var table = $("#example").DataTable({
       //default is lfrtip 
       dom: 'frtlip'    
    });
    
    //lengthmenu -> add a margin to the right and reset clear 
    $(".dataTables_length").css('clear', 'none');
    $(".dataTables_length").css('margin-right', '20px');
    
    //info -> reset clear and padding
    $(".dataTables_info").css('clear', 'none');
    $(".dataTables_info").css('padding', '0');
    

    demo -> https://jsfiddle.net/psvf3z75/

    enter image description here