create pagination table from html

create pagination table from html

jessicajessica Posts: 4Questions: 1Answers: 0

Hi everyone,

I am creating the html to create the table structure and would like to spend settings iTotalRecords and iTotalDisplayRecords the html.
Is there any way to do this?

$(document).ready( function () {
var table = $('#example').DataTable();
} );

Name
Jessica
Rute

Answers

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    would like to spend settings iTotalRecords and iTotalDisplayRecords the html

    Not quite sure what "spend settings" means exactly

  • jessicajessica Posts: 4Questions: 1Answers: 0

    I would like to implement paging through html

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    Still not sure what that means.

    If you mean you just want to have DataTables initiate on a table thats using the DOM as the source (eg: through html), then you dont really have to do anything other than initiate the DataTable on that table... As long as it has enough rows to start the paging (10 by default), then you will see the pagination on the bottom.

    Heres an example of a DataTable initiated on a table thats purely HTML, and as you can see, with no settings, the pagination is at the bottom.

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75
    edited October 2015

    Are you trying to implement custom settings for paging to override the defaults?

    Just look into the paging, lengthMenu, lengthChange and pageLength settings

  • jessicajessica Posts: 4Questions: 1Answers: 0
    edited October 2015

    then I ride a table html eg with 10 lines, but this table has 100 rows, as I step into the plugin that this table has 100 line and not 10, to automatically generate the correct paging html

  • allanallan Posts: 61,823Questions: 1Answers: 10,129 Site admin

    You are going to have to give us a link to the page you are working with - I don't actually understand what you are looking for I'm afraid.

    DataTables will automatically create the required paging from a DOM sourced table. The iTotalRecords and iTotalDisplayRecords parameters are for legacy server-side processing and have nothing to do with a DOM sourced table.

    Allan

  • jessicajessica Posts: 4Questions: 1Answers: 0
    edited November 2015

    good Morning,
    sAjaxSource am using to generate my table.
    I would like to pass the parameters of the form

    $(document).ready(function() {
        $('#example').dataTable( {
            "bProcessing": true,
            "bServerSide": true,
            "sAjaxSource": "url",
            "fnServerParams": function ( aoData ) {
    $("#form").serialize()
            }
        } );
    } );
    
  • allanallan Posts: 61,823Questions: 1Answers: 10,129 Site admin

    $("#form").serialize()

    That isn't doing anything. You aren't assigning the result to anything. This legacy example might be of some use, but I would encourage you to consider using the modern method with ajax.

    Allan

This discussion has been closed.