Advanced User Interface Controls and Components
Sets the position of the scroll tree in TreeView.
Param | Type | Details |
---|---|---|
pos | Object | The object that reprsents the new position of TreeView scrollbar |
This method does not return a value.
Supported in: v1.0.
In this example we are showing how to use setScrollPos method to change through code the position of vertical and/or horizontal scrollbar in TreeView. This method will trigger the scrollposchanged event.
$(document).ready(function() {
// Create an instance of TreeView widget
var $tree = $('#treeview').treeview();
var getCurrentSelection = function(){
return $tree.treeview("option", "selectedItem");
}
var scrollPos = {
x: 20,
y: 100
}
var pos = $tree.treeview("setScrollPos", scrollPos);
});
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/integralui.treeview.css" />
<link rel="stylesheet" href="css/themes/theme-blue.css" />
<script type="text/javascript" src="external/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="external/jquery.ui.core.min.js"></script>
<script type="text/javascript" src="external/jquery.ui.widget.min.js"></script>
<script type="text/javascript" src="js/jquery.integralui.widget.min.js"></script>
<script type="text/javascript" src="js/jquery.integralui.treeview.min.js"></script>
</head>
<body>
<div id="treeview" class="widget"></div>
</body>
</html>
.widget
{
width: 300px;
height: 300px;
}
angular
.module("appModule", ["integralui"])
.controller("appCtrl", ["$scope", "IntegralUITreeViewService", function($scope, $treeService){
$scope.data = [];
$scope.treeName = "treeSample";
var scrollPos = {
x: 20,
y: 100
}
$treeService.setScrollPos($scope.treeName, scrollPos);
}]);
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/integralui.treeview.css" />
<link rel="stylesheet" href="css/themes/theme-blue.css" />
<script type="text/javascript" src="external/angular.min.js"></script>
<script type="text/javascript" src="js/angular.integralui.treeview.min.js"></script>
</head>
<body>
<div ng-app="appModule" ng-controller="appCtrl">
<integralui-treeview name="{{treeName}}" items="data"></integralui-treeview>
</div>
</body>
</html>