Add the number of total rows in sLengthMenu

Add the number of total rows in sLengthMenu

JayCoderJayCoder Posts: 1Questions: 1Answers: 0

Hi,

I'm trying to figure how to get the total number of rows in the Datatable after the "show records on page" -dropdown, like "Show [dropdown] on page (total 300)"

I saw a count example somewhere like:
var table = $('#example').DataTable();

alert( 'Rows '+table.rows( '.selected' ).count()+' are selected' );

But the problem is. my table is an aspx-gridview so my call is like this since the table is a server-control:
$(document).ready(function () {
$('#<%= ResultGrid.ClientID %>').DataTable()

I can't put ASP code in a JavaScript file

Thanks,
Jay

Answers

  • colincolin Posts: 15,236Questions: 1Answers: 2,598

    Hi @JayCoder ,

    You could do something like this, which would probably be easiest as it keeps it all in the table initialisation.

    Hope that does the trick,

    Cheers,

    Colin

This discussion has been closed.