Hi
I want to display Showing 1 to 87 of 87 entries at the top instead of bottom.
JavaScript
$(function () {
$("[id*=grdPlanning]").DataTable(
{
//bLengthChange: true,
//lengthMenu: [[5, 10, -1], [5, 10, "All"]],
//bFilter: true,
order: [[11, 'asc']],
"bDestroy": true
//,
//bSort: true
/*bPaginate: true*/
});
});Thanks

Muhammad Imran AnsariRank #326 · 7.6K reputationPosted Jun 9, 2023, 4:40 PM EDT
You can use the DataTables plugin's built-in functionality for customizing the table layout. Here's an updated version of your code that achieves this:
$(function () { var table = $("[id*=grdPlanning]").DataTable({ order: [[11, 'asc']], "bDestroy": true, "bLengthChange": true, "lengthMenu": [[5, 10, -1], [5, 10, "All"]], "bFilter": true, "bSort": true, "bPaginate": true, "language": { "info": "Showing _START_ to _END_ of _TOTAL_ entries", "infoEmpty": "Showing 0 to 0 of 0 entries" } }); // Move the info element to the top var info = table.table().container().querySelector('.dataTables_info'); var wrapper = document.createElement('div'); wrapper.classList.add('info-wrapper'); wrapper.appendChild(info); table.table().container().insertBefore(wrapper, table.table().container().firstChild); });Tuhin PaulRank #7 · 71.9K reputationPosted Jun 10, 2023, 8:12 AM EDT
$(function () { $("[id*=grdPlanning]").DataTable({ order: [[11, 'asc']], dom: ">" + ">" + ">", "language": { "info": "Showing _START_ to _END_ of _TOTAL_ entries", "infoEmpty": "Showing 0 to 0 of 0 entries", "emptyTable": "No data available", "lengthMenu": "Show _MENU_ entries", "paginate": { "first": "First", "last": "Last", "next": "Next", "previous": "Previous" } } }); });The dom option is set to a custom value that defines the layout of the DataTable. The "Showing 1 to 87 of 87 entries" message is placed at the top by specifying the desired HTML structure. The language option is set to customize the language and text displayed by DataTables, including the pagination and information messages.