technical.store.technical
Posted 1 June 2021, 6:19 pm EST
Hi Sharad,
Thank you for responding.
We have following doubts in this snippet :
- initially in HTML we use to show ALL preselection condition as per the collection length.
<wj-flex-grid-column [header]="'Subjects'" [binding]="'subjects'" [isReadOnly]="true">
<!-- <ng-template wjFlexGridCellTemplate cellType="Cell" let-item="item">
<div *ngIf="item.subjects.length === subjects.length">ALL</div>
<div *ngIf="item.subjects.length < subjects.length">{{item.subjects.join(', ')}}</div>
</ng-template>
<ng-template wjFlexGridCellTemplate [cellType]="'Cell'" let-cell="cell">
<wj-multi-select #multSelect [(checkedItems)]="cell.item.subjects"
[itemsSource]="cell.item.isNew? additionalSubjects : totalSubjects"
[showSelectAllCheckbox]="showSelectAllCheckbox"
[headerFormat]="multSelect.checkedItems.length !== multSelect.itemsSource?.length? multSelect.checkedItems.toString():'ALL'">
</wj-multi-select>
</ng-template> -->
<ng-template wjFlexGridCellTemplate [cellType]="'NewCellTemplate'">
<wj-multi-select [checkedItems]="additionalSubjects" [itemsSource]="additionalSubjects" [headerFormat]="'All'">
</wj-multi-select>
</ng-template>
</wj-flex-grid-column>
How we can add this conditions in ts file ?
- On selection of a section column value, we need to change the subject for that particular row.
getSubjects(cell) {
if (cell.section == 'A')
return ['maths', 'english', 'Computers', 'chemistry', 'korean'];
else if (cell.section == 'B') return this.totalSubjects;
else if (cell.section == 'C')
return ['english', 'physics', 'chemistry', 'maths'];
else return ['maths', 'Computers', 'chemistry', 'drama', 'korean'];
}
On Initial load subjects collection value is getting updated but on section cell value change , subject collection is not getting updated.
How can we implement this ?
Snippet Link -
https://stackblitz.com/edit/angular-ecgjl1?file=src/app/app.component.ts
Thank You.