Closed aandriichuk closed 7 years ago
Upon checking the code, we notice that code that fires expand/collapse events was disabled in current version, during internal testing. Unfortunately, this remained when current beta version was released.
The fix will be included as part of new update coming next week. This update will also include the Grid and TreeGrid components.
We have just released v0.9.0, now the expand/collapse events are fired whenever item is expanded or collapsed.
Thank you. I'll try
I also want ask you do you have examples how to use following methods collapse expand findItemById findItemByText insertItemAfter insertItemBefore insertItemAt removeItem scrollPos toggle
It seems they were not available in previous version but described in documentation here http://www.lidorsystems.com/support/articles/angular/treeview/treeview-component.aspx.
As it is explained in the article:
import { IntegralUITreeView } from 'integralui-web/components/integralui.treeview';
<iui-treeview [items]="data" #treeVariable>
<template let-item>
{{item.text}}
</template>
</iui-treeview>
@ViewChild('treeVariable') treeview: IntegralUITreeView;
Use the reference to access public methods
let item = {
text: "New Item"
}
this.treeview.insertItemAt(item, 0);
Here are method signatures:
insertItemAt(item, index, parent?)
insertItemBefore(item, refItem)
insertItemAfter(item, refItem)
removeItem(item)
removeItemAt(index, parent?)
Methods mentioned:
collapse(item?)
expand(item?)
toggle(item?)
scrollPos(pos?)
are not yet available. We will update the beta version later today, and you can use it.
Documentation is still in works. Soon we will publish a complete API for each component and a User Guide.
We have released v0.9.012. Whenever a version is released, check out the Change_Log for more information.
The expand/collapse methods are now available, along with scrollPos method. Their use is simple, for example:
// To expand all items
this.treeview.expand();
// To expand specific item
this.treeview.expand(item);
// To change scroll position from code
// this will move horizontal scroll to 100px and vertical scroll to 500px
this.treeview.scrollPos({ x: 100, y: 500 });
// To get current scroll positon
this.treeview.scrollPos();
To use findItemById or findItemByText, at first item objects must have its id or text field set. For example:
this.items.length = 0;
for (let i = 1; i <= 100; i++)
this.items.push({ id: i, text: "Item" + i });
let item = this.treeview.findItemById(5);
console.log(item);
Thank you!
Hello. For some reason beforeExpand event is not triggered but itemAddedEvent works fine. Do you have any ideas?
// treeview.component.html
<div #application> <iui-treeview [items]="items" [appRef]="applicationRef" (itemAdded)="itemAddedEvent($event)" (beforeExpand)="beforeExpandEvent($event)" #treeview>
// treeview.component.html
import { Component, ViewEncapsulation, ViewChild, ViewChildren, ViewContainerRef, OnInit } from '@angular/core'; import { IntegralUITreeView } from 'integralui-web/components/integralui.treeview'; import { FileExplorerService } from '../file-explorer.service';
@Component({ selector: 'treeview', template: require('./treeview.component.html'), styles: [require('./treeview.component.css')], encapsulation: ViewEncapsulation.None }) export class TreeViewComponent implements OnInit {
}