Я использую угловой 5 и хочу реализовать таблицу дерева с сортируемой строкой таблицы, но строка сортировки не работала с кодом ниже.
<table class="table table-bordered tabledesign"> <thead> <tr> <th></th> <th>Sr #</span></th> <th>Name</th> <th>Is Active</th> <th>Action</th> </tr> </thead> <tbody> <ng-container *ngTemplateOutlet="treeViewTemplate; context:{ $implicit: menusList }"> </ng-container> </tbody> </table> <bs-sortable [(ngModel)]="menusList" itemClass="sortable-item" itemActiveClass="sortable-item-active" placeholderItem="Drag here" placeholderClass="placeholderStyle" wrapperClass="sortable-wrapper" (ngModelChange)="participantSortingChange($event)" [itemTemplate]="treeViewTemplate"> </bs-sortable> <ng-template #treeViewTemplate let-menusList> <ng-container *ngFor="let parameter of menusList"> <tr [ngStyle]="{'background-color': parameter.color ? parameter.color : '' }"> <td class="text-left"> <a *ngIf="parameter.child_menus?.length > 0" (click)="parameter.expand = !parameter.expand"> <i class="fa plus-icon" [ngClass]="parameter.expand ? 'fa-minus-square-o' : 'fa-plus-square-o'"></i> </a> <i *ngIf="parameter.child_menus?.length <= 0" class="fa fa-circle" style="font-size: 10px; padding-right: 3px;color: #f68c1f;"></i> </td> <td>{{parameter.sr_no}}</td> <td class="text-left">{{parameter.name}}</td> <td class="text-left text-transform">{{parameter.is_active}}</td> <td class="text-center"> <a class="iconbtn btn-type1" data-title="View" tooltip="Add Sub Menu" (click)="showSubMenuModal(parameter)"> <i class="fa fa-plus"></i> </a> <a class="iconbtn btn-type1" data-title="Edit" tooltip="Edit" (click)="showEditMenuModal(parameter)"> <i class="fa fa-pencil"></i> </a> <a class="iconbtn btn-type1" data-title="Delete" tooltip="Delete" (click)="showDeleteDialog(parameter)"> <i class="icon-trash"></i> </a> </td> </tr> <ng-container *ngIf="parameter.expand && parameter.child_menus?.length > 0" class="pl-4"> <ng-container *ngTemplateOutlet="treeViewTemplate; context:{ $implicit: parameter.child_menus }"> </ng-container> </ng-container> </ng-container> </ng-template>
с использованием bs-sortable Я не могу переместить любую строку таблицы, так как я могу реализовать сортируемую строку таблицы