How to show "Show X entries" and Showing 1 to X of X entries on the top and bottom position

How to show "Show X entries" and Showing 1 to X of X entries on the top and bottom position

comicragecomicrage Posts: 12Questions: 2Answers: 0
edited April 2013 in General
HI,

After the datatable is populated, how do I position the Show X entries and Showing 1 to X of X entries on top and bottom of the DataTable?

Thanks

Replies

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin
    Use sDom - see http://datatables.net/release-datatables/examples/basic_init/dom.html

    Allan
  • comicragecomicrage Posts: 12Questions: 2Answers: 0
    Hi, I looked at the online document and started playing around with the sDom placement.

    After playing with different lifp combination, I was able to get the Show X entries and information on the first line and the filter on the next line. This is above the datatable.

    Below the datatable, I was able to get teh information (Showing 1 to 10 of XXX entries) on the first line, and the Show X entries and pagination on the next line.

    My question, how can I get all three controls all on 1 line for the top and bottom. Thanks..

    var oResultGrid = $("[id$='gvSearchResults']");

    if (fixEmptyDataRow(oResultGrid)) {

    var oTable = oResultGrid.dataTable({
    "bPaginate": false,
    "bFilter": false,
    "bInfo": false,
    "sDom": '<"top"lif<"clear">>rt<"bottom"ipl<"clear">>'
    });
    }
    else {

    oResultGrid.dataTable({

    "sPaginationType": "full_numbers",
    "aaSorting": [[2, 'asc']],
    "sDom": '<"top"lif<"clear">>rt<"bottom"ipl<"clear">>'
    });
    }
  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin
    Just repeat the control letters that you want - i.e. have two `i` for the paging information elements - one above and one below.

    Allan
This discussion has been closed.