Open In App

EasyUI jQuery treegrid Widget

EasyUI is an HTML5 framework for using user interface components based on jQuery, React, Angular, and Vue technologies. It helps in building features for interactive web and mobile applications saving a lot of time for developers.

In this article, we will learn how to design treegrid using jQuery EasyUI. The treegrid is used to show hierarchical data in a grid.



Downloads for EasyUI for jQuery:

https://www.jeasyui.com/download/index.php

Syntax:



<input class="easyui-treegrid">

 

Properties:

Events:

Methods:

Approach: First, add jQuery Easy UI scripts needed for your project.

<script type=”text/javascript” src=”jquery.min.js”>   </script>  

<!–jQuery libraries of EasyUI –>
<script type=”text/javascript” src=”jquery.easyui.min.js”>   </script>  

<!–jQuery library of EasyUI Mobile –>
<script type=”text/javascript” src=”jquery.easyui.mobile.js”>   </script> 

Example:




<!DOCTYPE html>
<html>
  
<head>
    <link rel="stylesheet" type="text/css" 
        href=
  
    <link rel="stylesheet" type="text/css" 
        href=
  
    <script type="text/javascript" src=
    </script>
  
    <script type="text/javascript" src=
    </script>
  
    <script type="text/javascript">
        $(document).ready(function() {
            $('#gfg').treegrid({
                rownumbers: true,
                showFooter: true,
                idField: 'id',
                treeField: 'region',
                animate: true
            });
        });
    </script>
</head>
  
<body>
    <h2>GeeksforGeeks</h2>
  
    <p>jQuery EasyUI TreeGrid Widget</p>
  
    <div style="margin:20px 0;"></div>
    <table id='gfg' title="EasyUI TreeGrid">
        <thead>
            <tr>
                <th colspan="4">Geek1</th>
                <th colspan="4">Geek2</th>
            </tr>
            <tr>
                <th field="1" width="60" 
                    align="Center">A</th>
  
                <th field="2" width="60" 
                    align="Center">B</th>
  
                <th field="3" width="60" 
                    align="Center">C</th>
                  
                <th field="4" width="60" 
                    align="Center">D</th>
                  
                <th field="5" width="60" 
                    align="Center">E</th>
                  
                <th field="6" width="60" 
                    align="Center">F</th>
                  
                <th field="7" width="60" 
                    align="Center">G</th>
                  
                <th field="8" width="60" 
                    align="Center">H</th>
            </tr>
        </thead>
    </table>
</body>
  
</html>

 

Output:

Treegrid

 

Reference: http://www.jeasyui.com/documentation/


Article Tags :