LIDOR SYSTEMS

Advanced User Interface Controls and Components

IntegralUI Web

Native Angular 4 and AngularJS UI Components


TreeView / Tooltip


In this sample you can see how to attach a tooltip to each item in the TreeView directive.

Whenever a mouse cursor enters the item label space, a tooltip will appear. To simplify this example, the default tooltip settings are used and only the tooltip title is set.

We are using the IntegralUI Tooltip directive to apply a tooltip to TreeView items. This directive accepts an object with all options that determines the appearance and behavior of the tooltip. Here is a list of available options for the Tooltip directive:

  • enabled - determines whether the Tooltip is enabled or disabled
  • showMarker - when true, an arrow marker will be displayed for the Tooltip window
  • title - title of the Tooltip, can contain multiple lines of text or any custom HTML
  • position - determines where the Tooltip will appear: above, below, left or right side of the target element or at mouse position
  • initialDelay - the time in miliseconds prior Tooltip is shown
  • autoPopDelay - the time in miliseconds for Tooltip to remain visible

In our example, all tooltips are set after the initial data is set. You can attach/detach a tooltip or change its settings at any time, changes are applied automatically.

<!DOCTYPE html>

<html>

<head>

<link rel="stylesheet" href="css/integralui.css" />

<link rel="stylesheet" href="css/integralui.treeview.css" />

<link rel="stylesheet" href="css/integralui.tooltip.css" />

<link rel="stylesheet" href="css/themes/theme-flat-blue.css" />

<script type="text/javascript" src="external/angular.min.js"></script>

<script type="text/javascript" src="js/angular.integralui.min.js"></script>

<script type="text/javascript" src="js/angular.integralui.lists.min.js"></script>

<script type="text/javascript" src="js/angular.integralui.treeview.min.js"></script>

<script type="text/javascript" src="js/angular.integralui.tooltip.min.js"></script>

</head>

<body>

<div ng-app="appModule" ng-controller="appCtrl">

<iui-treeview name="{{treeName}}" items="data" allow-focus="false"></iui-treeview>

</div>

</body>

</html>

angular

.module("appModule", ["integralui"])

.controller("appCtrl", ["$scope", "IntegralUITreeViewService", "$timeout", function($scope, $treeService, $timeout){

$scope.treeName = "treeSample";

 

$scope.data = [

{

id: 1,

text: "Item1",

items: [

{ id: 11, pid: 1, text: "Item11" },

{

id: 12,

pid: 1,

text: "Item12",

items: [

{ id: 121, pid: 12, text: "Item121" },

{

id: 122,

pid: 12,

text: "Item122",

expanded: false,

items: [

{ id: 1221, pid: 122, text: "Item1221" },

{ id: 1222, pid: 122, text: "Item1222" }

]

},

{ id: 123, pid: 12, text: "Item123" },

{ id: 124, pid: 12, text: "Item124" },

{ id: 125, pid: 12, text: "Item125" }

]

},

{ id: 13, pid: 1, text: "Item13" },

{

id: 14,

pid: 1,

text: "Item14",

items: [

{ id: 141, pid: 14, text: "Item141" },

{ id: 142, pid: 14, text: "Item142" }

]

}

]

},

{

id: 2,

text: "Item2",

expanded: false,

items: [

{ id: 21, pid: 2, text: "Item21" },

{ id: 22, pid: 2, text: "Item22" },

{

id: 23,

pid: 2,

text: "Item23",

expanded: false,

items: [

{ id: 231, pid: 23, text: "Item231" },

{ id: 232, pid: 23, text: "Item232" }

]

}

]

},

{ id: 3, text: "Item3" },

{ id: 4, text: "Item4" },

{ id: 5, text: "Item5" },

{

id: 6,

text: "Item6",

items: [

{ id: 61, pid: 6, text: "Item61" },

{ id: 62, pid: 6, text: "Item62" }

]

},

{ id: 7, text: "Item7" }

];

 

var initTimer = $timeout(function(){

var list = $treeService.getFlatList($scope.treeName, true);

for (var i = 0; i < list.length; i++)

list[i].tooltip = { title: list[i].text }

 

$timeout.cancel(initTimer);

}, 1);

}]);

.iui-tooltip

{

font-size: 0.75em;

}