I have 2 questions about the Treeview.
1) I need some extra custom properties on the nodeData so I can use them on event nodeSelected.See below my code I have sofar, but that doesn't work (see colored line). How can I accomplish this?
selected Object = null;
data: Object = [{ fullPath: 'd:\\data\\document1.docx', parentPath: 'd:\\data', name: 'document1.docx', type: 'file', isFolder: false, createdOn: '2018-07-25'}];
fields: Object = { dataSource: this.data, id: 'fullPath', parentID: 'parentPath', text: 'name', hasChildren: 'isFolder', iconCss: 'type', createdOn: 'createdOn' };
nodeSelected(args: NodeSelectEventArgs) {
let fullPath = args.nodeData["id"];
let parentPath = args.nodeData["parentID"];
let name = args.nodeData["text"];
let createdOn = args.nodeData["createdOn"]; // custom property does not exists...
this.selected = { name: name, fullPath: fullPath, createdOn: createdOn };
}
2) I try to show an icon before the folder-node, but
css:
.e-treeview .e-list-img {
width: 25px;
height: 25px;
}
.e-treeview .e-list-icon {
background-repeat: no-repeat;
background-image: url('http://ej2.syncfusion.com/angular/demos/src/images/icons/file_icons.png');
height: 20px;
}
.e-treeview .e-list-icon.folder { background-position: -10px -552px }
.e-treeview .e-list-icon.file { background-position: -10px -20px }
I see that this is rendered on each folder-node:
<div class="e-list-icon folder"></div>
but it doesn't display any icon.
When I add this:
constructor( @Inject('sourceFiles') private sourceFiles: any) {
sourceFiles.files = ['icons.component.css'];
}
I get an error that the provider for sourceFiles was not found.
Is this piece of code neccesary? If yes, which type should I use for the provider?