|
[Script]
var localData = [
{ id: 1, name: "Discover Music", hasChild: true, expanded: true }
]
$("#treeView").ejTreeView({
fields: { id: "id", parentId: "pid", text: "name", hasChild: "hasChild", dataSource: localData, expanded: "expanded" }
}); |
|
[CSS]
.mytree .e-item .e-text {
font-size:18px;
}
.mytree .e-fullrow{
height: 27px;
margin-top: -26px;
}
.mytree .e-plus, .mytree .e-minus, .mytree .e-icon.e-load{
padding-top:9px;
} |
|
[Script]
//To prevent closing the bootstrap drown popup.
$("#demo").bind("click", function (e) {
//Prevent popup closing except TreeView text clicked
if (!$(e.target).hasClass('e-text')) {
e.stopPropagation();
}
});
|
|
[Script]
var tree = $('#fullrowtree>.e-ul'),
height = tree.outerHeight();
tree.bind('mousewheel', function (e) {
var scrollHeight = e.currentTarget.scrollHeight;
var isWheelUp = (e.originalEvent.deltaY > 0) ? true : false;
//prevent parent scrolling when TreeView scroll moves to end or start position
if ((scrollHeight > height) && ((this.scrollTop === (scrollHeight - height) && isWheelUp) || (this.scrollTop === 0 && !isWheelUp))) {
return false;
}
});
|
|
[Script]
var tree = $('#fullrowtree>.e-ul'),
height = tree.outerHeight();
tree.bind('mousewheel DOMMouseScroll', function (e) {
var scrollHeight = e.currentTarget.scrollHeight, isWheelUp;
if (e.type == 'mousewheel') {
isWheelUp = (e.originalEvent.wheelDelta > 0) ? true : false;
}
else if (e.type == 'DOMMouseScroll') {
isWheelUp = (e.originalEvent.detail < 0) ? true : false;
}
//prevent parent scrolling when TreeView scroll moves to end or start position
if ((scrollHeight > height) && ((this.scrollTop === (scrollHeight - height) && !isWheelUp) || (this.scrollTop === 0 && isWheelUp))) {
return false;
}
});
|