VOOZH about

URL: https://www.geeksforgeeks.org/jquery/datatables-pagingtype-option/

⇱ DataTables pagingType Option - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

DataTables pagingType Option

Last Updated : 13 Jul, 2021

DataTables is a jQuery plugin that can be used for adding interactive and advanced controls to HTML tables for the webpage. This also allows the data in the table to be searched, sorted, and filtered according to the needs of the user. The DataTable also exposes a powerful API that can be further used to modify how the data is displayed.

The pagingType option is used to specify the type of controls that will be displayed below the DataTable for pagination. It accepts a string value that can be specified by using 6 built-in types of available controls. These are specified by the following values.

  • simple: In this type of control, only the 'Previous' and 'Next' buttons are displayed.
  • simple_numbers: In this type of control, the 'Previous' and 'Next' buttons are displayed along with the page numbers.
  • full: In this type of control, only the 'First', 'Previous', 'Next' and 'Last' buttons are displayed.
  • full_numbers: In this type of control, the 'First', 'Previous', 'Next', and 'Last' buttons are displayed along with the page numbers.
  • numbers: In this type of control, only the page numbers are displayed.
  • first_last_numbers: In this type of control, the 'First' and 'Last' buttons are displayed along with the page numbers.

Other types can be added using DataTable plugins.

Syntax:

{ pagingType: value }
 

Parameters: This option has a single value as mentioned above and described below.

  • value: This is a string value that specifies the type of controls that will be displayed.

The example below illustrates the use of this option. We will see all the different paging types that are built-in to DataTables.

Example 1: In this type of control, the buttons are displayed along with the page numbers.

Output:

👁 Image

Example 2:  In this type of control, only the 'Previous' and 'Next' buttons are displayed.

Output:

👁 Image

Example 3:In this type of control, the 'Previous' and 'Next' buttons are displayed along with the page numbers

Output:

👁 Image

Example 4: In this type of control, only the 'First', 'Previous', 'Next', and 'Last' buttons are displayed.

Output:

👁 Image

Example 5: In this type of control, the 'First', 'Previous', 'Next', and 'Last' buttons are displayed along with the page numbers.

Output:

👁 Image

Example 6: In this type of control, the 'First' and 'Last' buttons are displayed along with the page numbers.

Output:

👁 Image

Reference Link: https://datatables.net/reference/option/pagingType

Comment
Article Tags:

Explore