Is there a way to use a horizontal tree with selectionMode="checkbox"
?
I have seen an example using PrimeFaces, but I needed this in PrimeNG.
I have tried this:
HTML
<p-tree
[value]="files"
layout="horizontal"
selectionMode="checkbox"
[(selection)]="selectedFiles"
></p-tree>
TS
import { Component } from '@angular/core';
import { NodeService } from './nodeservice';
import { TreeNode } from 'primeng/api';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
})
export class AppComponent {
files: TreeNode[];
selectedFiles: TreeNode;
constructor(private nodeService: NodeService) {}
ngOnInit() {
this.nodeService.getFiles().then((files) => (this.files = files));
}
}
You can try this code in this stackblitz project, but it doesn't seem to work.
Am I doing anything wrong or is it not supported?