Documentation
SolutionDeveloperComplianceProjects
  • Getting Started
  • Technology
    • Application Framework
    • Object-Relational Mapping
    • Security Framework
    • Architecture Pattern
    • API Management
  • Environment
    • Development Tool
    • Database Server
    • Web Server
  • PRESENTATION
    • Design Material
    • HTML Helpers
    • Icon Images
    • Custom CSS
    • JQuery Plugin
      • DataTables
      • Tabs
      • Date Picker
      • Calendar
      • Chart
      • Treeview
    • Client Script
      • Open Modal
      • Close Modal
      • Handle return data
      • Load Content
      • Change Hash
      • Change Title
      • Get actual Hash
      • Get Content
      • Update Content
      • Delete Content
      • Get Partial Content
      • Get Partial Content Async
      • Update Partial Content
      • Update Partial Content Async
      • Delete Partial Content
      • Get Action
      • Update Action
      • Delete Action
      • Cascading Dropdown
      • Display Document
    • MVC View
  • BACKEND
    • Base Controller
    • Controller
    • Base Model
    • View Model
    • Class Utility
      • Constant Values
      • Global Properties
      • Option Helper
      • Setting Helper
    • Data Repository
      • Read Columns
      • Read All Columns
      • Read First Record
      • Read by Primary Key
      • Find Record
      • Insert Record
      • Update Record
      • Delete Entity
      • Delete by Criteria
      • Delete by Primary Key
      • Counting Record
      • Check Exist
      • Generate Row-Id
    • Unit Of Work
    • Data Entity
  • Application Features
    • Account Management
    • Navigation Editor
    • Access Control
  • Examples
    • Simple Page
    • Master Detail
    • Editor Template
Powered by GitBook
On this page
  • General information
  • Installation
  • How to use
  • Examples
  • Example: Tree with Selectable Leaves
  1. PRESENTATION
  2. JQuery Plugin

Treeview

PreviousChartNextClient Script

Last updated 2 years ago

General information

AciTree is a plug-in for the jQuery library that provides a tree view with various interactive features whose layout and functionalities can be customized.

A typical treeview in our applications looks like this:

Installation

  1. Store the downloaded files in the folder "Plugins" > "acitree" (Create the file if it does not exist yet)

  2. Add the following lines in the "Layout.cshtml" file

<link rel="stylesheet" href="~/Plugins/acitree/css/aciTree.css" />
    <script type="text/javascript" src="~/Plugins/acitree/js/jquery.aciPlugin.min.js"></script>
    <script type="text/javascript" src="~/Plugins/acitree/js/jquery.aciTree.core.js"></script>
    <script type="text/javascript" src="~/Plugins/acitree/js/jquery.aciTree.min.js"></script>

How to use

The simplest form of the treeview is implemented in the following way:

<div id="tree" class="aciTree"></div>
<script>

    $(document).ready(function () {

        // initiate XXX list tree
        var jsonObj = '@Html.Raw(Json.Encode(Model.XXXList))'
        
        $('#tree').aciTree({
            ajax: null,
            rootData: $.parseJSON(jsonObj),
            selectable: false
        });
        
    });
        
</script>

Examples

Example: Tree with Selectable Leaves

The following code implements the functionality of a tree whose leaves can be selected ("selectable" set to true) and when a leaf is clicked, its id will get displayed in an alert pop-up:

<script>

    $(document).ready(function () {

        // Initiate Parts list tree
        var jsonObj = '@Html.Raw(Json.Encode(Model.PartsList))'
        
        $('#tree').aciTree({
            ajax: null,
            rootData: $.parseJSON(jsonObj),
            selectable: true
        });

        //handle select event
        $('#tree').on("acitree", function (event, api, item, eventName, options) {
            if (eventName == "selected") {
                var itemid = api.getId(item);
                alert(itemid);
            }
        });
        
    });
        
</script>

Download latest version of jQuery aciTree from the following link:

https://github.com/dragosu/jquery-aciTree