Open In App

jQWidgets jqxDataTable showAggregates Property

Last Updated : 07 Oct, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

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 showAggregates property is used to check whether the aggregates bar of the specified jqxDataTable is visible or not. This property is having two possible values that are “true” and “false”.

Syntax:

For setting the showAggregates property:

$('#dataTable').jqxDataTable({showAggregates: true});  

 

For getting the showAggregates property:

var showAggregates = 
    $('#dataTable').jqxDataTable('showAggregates'); 

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 showAggregates property. In the below example, the value for the showAggregates property has been set to “true”.

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 
            showAggregates Property
        </h3>
        <div id="#Data_Table"></div>
        <input type="button" style="margin: 29px;" 
               id="jqxbutton_for_showAggregates"
               value="Value of the showAggregates Property"/>
        <div id="log"></div>
        <script type="text/javascript">
            $(document).ready(function () {
                $("#Data_Table").jqxDataTable({
                    showAggregates: true,
                    columns: [{
                        text: 'Employee_Name',
                        dataField: 'Employee_Name',
                        aggregates: ['count'],
                        width: 190
                    }, {
                        text: 'Company',
                        dataField: 'Company',
                        aggregates: ['count'],
                        width: 160
                    }, {
                        text: 'Designation',
                        dataField: 'Designation',
                        aggregates: ['count'],
                        width: 190
                    }]
                });
                $("#jqxbutton_for_showAggregates").
                    jqxButton({
                        width: 280
                    });
                $('#jqxbutton_for_showAggregates').
                    click(function () {
                        var value_of_showAggregates =
                            $('#Data_Table').
                                jqxDataTable(
                                    'showAggregates');
                        $("#log").html(JSON.stringify(
                            value_of_showAggregates))
                    });
            });
        </script>
        <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>
</body>
  
</html>


Output:

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



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads