You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can someone help me out here?
I have a table with data from an api endpoint. Now I want to fill in the table and add an extra checkbox on every row.
If I click on the row, the checkbox will also be selected. This I don't want. The selection of the row and the checkbox needs to work independently. It does not mean that if I select the row that it cannot change the css of the checkbox like it does with the other columns.
I get also an errormessage from PrimeNG library. If I select the row. coming from an event triggered by the checkbox I assume. Error is : this.dt.selection.some is not a function .I also tried with onRowSelect on p-table to try to exclude the checkbox for selection, but that did also not work out.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
Can someone help me out here?
I have a table with data from an api endpoint. Now I want to fill in the table and add an extra checkbox on every row.
If I click on the row, the checkbox will also be selected. This I don't want. The selection of the row and the checkbox needs to work independently. It does not mean that if I select the row that it cannot change the css of the checkbox like it does with the other columns.
I get also an errormessage from PrimeNG library. If I select the row. coming from an event triggered by the checkbox I assume. Error is : this.dt.selection.some is not a function .I also tried with onRowSelect on p-table to try to exclude the checkbox for selection, but that did also not work out.
Thanks for also have a look :).
Regards,
html
<p-table
[columns]="displayedColumns"
[totalRecords]="totalRecords"
[value]="courtCostStatements"
[scrollable]="true"
scrollHeight="75vh"
[rows]="30"
[virtualScroll]="true"
[virtualScrollItemSize]="virtualScrollItemSize"
[lazy]="true"
[size]="'small'"
showGridlines
stripedRows
sortField="caseNumber"
selectionMode="single"
metaKeySelection="isMetaKey"
[(selection)]="selectedCourtCostStatement"
(onLazyLoad)="loadCourtCostStatementsEventAsync($event)"
dataKey="id">
{{ columnHeader.id.translationKey| translate }}
{{ columnHeader.caseNumber.translationKey | translate }}
{{ columnHeader.serviceProvider.translationKey | translate }}
<th pSortableColumn="serviceTypeNl" *ngIf="currentLanguage.toLowerCase() === 'nl'">{{ columnHeader.serviceType.translationKey | translate }}
<th pSortableColumn="statusNl" *ngIf="currentLanguage.toLowerCase() === 'nl'">{{ columnHeader.status.translationKey | translate }}
<th pSortableColumn="serviceTypeFr" *ngIf="currentLanguage.toLowerCase() === 'fr'">{{ columnHeader.serviceType.translationKey | translate }}
<th pSortableColumn="statusFr" *ngIf="currentLanguage.toLowerCase() === 'fr'">{{ columnHeader.status.translationKey | translate }}
<th pSortableColumn="serviceTypeEn" *ngIf="currentLanguage.toLowerCase() === 'en'">{{ columnHeader.serviceType.translationKey | translate }}
<th pSortableColumn="statusEn" *ngIf="currentLanguage.toLowerCase() === 'en'">{{ columnHeader.status.translationKey | translate }}
<th pSortableColumn="serviceTypeDe" *ngIf="currentLanguage.toLowerCase() === 'de'">{{ columnHeader.serviceType.translationKey | translate }}
<th pSortableColumn="statusDe" *ngIf="currentLanguage.toLowerCase() === 'de'">{{ columnHeader.status.translationKey | translate }}
{{ columnHeader.caseManager.translationKey | translate }}
{{ columnHeader.submissionDate.translationKey | translate }}
<tr style="height: 37px" [pSelectableRow]="courtcostStatement">
<td [style]="courtCostStatementStatusLayout">
{{ courtcostStatement.id }}
{{ courtcostStatement.caseNumber }}
{{ courtcostStatement.serviceProvider }}
<td *ngIf="currentLanguage.toLowerCase() === 'nl'">{{ courtcostStatement.serviceTypeNl }}
<td *ngIf="currentLanguage.toLowerCase() === 'nl'">{{ courtcostStatement.statusNl }}
<td *ngIf="currentLanguage.toLowerCase() === 'fr'">{{ courtcostStatement.serviceTypeFr }}
<td *ngIf="currentLanguage.toLowerCase() === 'fr'">{{ courtcostStatement.statusFr }}
<td *ngIf="currentLanguage.toLowerCase() === 'en'">{{ courtcostStatement.serviceTypeDe }}
<td *ngIf="currentLanguage.toLowerCase() === 'en'">{{ courtcostStatement.statusDe }}
<td *ngIf="currentLanguage.toLowerCase() === 'de'">{{ courtcostStatement.serviceTypeEn }}
<td *ngIf="currentLanguage.toLowerCase() === 'de'">{{ courtcostStatement.statusEn }}
{{ courtcostStatement.caseManager }}
{{ courtcostStatement.submissionDate | date }}
<p-tableCheckbox [value]="courtcostStatement" />
Typescript
`
import { CommonModule } from "@angular/common";
import { Component, OnDestroy, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { TranslateModule, TranslateService, LangChangeEvent } from "@ngx-translate/core";
import { firstValueFrom, Subscription } from "rxjs";
import { ProgressSpinnerModule } from 'primeng/progressspinner';
import { TableLazyLoadEvent, TableModule} from 'primeng/table';
import { LanguageEnum, CourtCostStatement } from "../../../generated";
import { CourtCostsService } from "../../../generated/api/courtCosts.service";
import { HEADERCOLUMNS_CASES, isValidColumnName, ColumnNames } from "../../../Shared/constants";
import { GenericErrorHandler } from "../../../services/errorhandler.service";
@component({
standalone: true,
selector: 'app-cases',
templateUrl: './cases.component.html',
styleUrls: ['./cases.component.scss'],
providers: [ CourtCostsService, TranslateService],
imports: [ CommonModule, TranslateModule, ProgressSpinnerModule, TableModule ],
})
export class CasesComponent implements OnInit, OnDestroy {
languages = [LanguageEnum.Nl, LanguageEnum.Fr, LanguageEnum.De, LanguageEnum.En];
filterIsNew: boolean = false;
isLoading = true;
}
`
Beta Was this translation helpful? Give feedback.
All reactions