Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

jQWidgets jqxDataTable pageChanged Event

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful, optimized, platform-independent, and widely supported framework. The jqxDataTable is used for reading and displaying the data from the HTML Table. This is also used to display data from various data sources like XML, JSON, Array, CSV, or TSV.

The pageChanged event is used to triggered when the current page of the specified jqxDataTable is changed.

Syntax:

$('#dataTable').on('pageChanged',  
function (event)
{
   // event args.
   var args = event.args;
   // page num.
   var pageNum = args.pagenum;
   // old page num.
   var oldPageNum = args.oldpagenum;
   // page size.
   var pageSize = args.pagesize;
});

Linked Files: Download jQWidgets from the given link. In the HTML file, locate the script files in the downloaded folder.

<link rel=”stylesheet” href=”jqwidgets/styles/jqx.base.css” type=”text/css” />
<script type=”text/javascript” src=”scripts/jquery.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcore.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxdata.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxbuttons.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxscrollbar.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxlistbox.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxdropdownlist.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxdatatable.js”></script>

Example: The below example illustrates the jQWidgets pageChanged event.

HTML




<!DOCTYPE html>
<html lang="en">
  
<head>
    <link rel="stylesheet" href=
        "jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" 
        src="scripts/jquery.js"></script>
    <script type="text/javascript" 
        src="jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" 
        src="jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" 
        src="jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" 
        src="jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" 
        src="jqwidgets/jqxlistbox.js"></script>
    <script type="text/javascript" 
        src="jqwidgets/jqxdropdownlist.js"></script>
    <script type="text/javascript" 
        src="jqwidgets/jqxdatatable.js"></script>
</head>
  
<body>
    <center>
        <h1 style="color: green">GeeksforGeeks</h1>
  
        <h3>jQWidgets jqxDataTable pageChanged Event</h3>
          
        <div id="#Data_Table"></div>
        <div id="log"></div>
          
        <table id="Data_Table" border="1">
            <thead>
                <tr>
                    <th>Employee_Name</th>
                    <th>Company</th>
                    <th>Designation</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>Rohit</td>
                    <td>GeeksforGeeks</td>
                    <td>HR</td>
                </tr>
                <tr>
                    <td>Rahul</td>
                    <td>Capgemini</td>
                    <td>Software Engineer</td>
                </tr>
                <tr>
                    <td>Vivek</td>
                    <td>CESC</td>
                    <td>Electrical Engineer</td>
                </tr>
                <tr>
                    <td>Amit</td>
                    <td>Apple</td>
                    <td>Manager</td>
                </tr>
            </tbody>
        </table>
    </center>
  
    <script type="text/javascript">
        $(document).ready(function () {
            $("#Data_Table").jqxDataTable({
                pageable: true,
                pageSize: 1,
                columns: [
                    {
                        text: "Employee_Name",
                        dataField: "Employee_Name",
                        width: 190,
                    },
                    {
                        text: "Company",
                        dataField: "Company",
                        width: 160,
                    },
                    {
                        text: "Designation",
                        dataField: "Designation",
                        width: 190,
                    },
                ],
            });
            $("#Data_Table").on("pageChanged", function (event) {
                var args = event.args;
                var Page_Number = args.pagenum;
                $("#log").html(JSON.stringify(Page_Number));
            });
        });
    </script>
</body>
  
</html>

Output:

Reference: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdatatable/jquery-datatable-api.htm?search=


My Personal Notes arrow_drop_up
Last Updated : 26 Sep, 2021
Like Article
Save Article
Similar Reads
Related Tutorials