grid - Angular 2 - PrimeNG - dataTable Expand one row at a time -
in primeng - there way allow 1 row expanded @ time ?
<p-datatable [value]="cars" expandablerows="true"> <p-column expander="true" styleclass="col-icon"></p-column> <p-column field="vin" header="vin"></p-column> <ng-template let-car ptemplate="rowexpansion"> ... </p-datatable>
i can give clue how solve , hope work you.
it not actual solution issue idea how solve this. using javascript in code. can convert angular way.
<p-datatable expandablerows="true" (onrowexpand) = "onrowexpand($event)">
onrowexpand(data : any) { var d = document.getelementsbyclassname('fa fa-fw ui-c ui-row-toggler fa-chevron-circle-down'); if (d.length > 0) { (var = 0; < d.length; i++) { this.renderer.setelementstyle(d[i].parentelement.parentelement.parentelement.nextelementsibling,'display','none') } } }
what doing here fetching class having fa-chevron-circle-down'. taking parent element recursively till <tr>. take next sibling element , can delete or can display none dynamically.
Comments
Post a Comment