Open Rjitendra opened 6 years ago
I have the same problem.
any one aware about issue plz post the solution
Please use the issue template: https://github.com/swimlane/ngx-datatable/blob/master/.github/ISSUE_TEMPLATE.md
Anybody knows how to make checkboxes selected by default?
Anybody knows how to make checkboxes selected by default? [rowIdentity]="rowIdentity" [displayCheck]="displayCheck" [selected]="selected" [selectionType]="SelectionType.checkbox" [selectAllRowsOnPage]="false" (select)="onSelect($event)"
in
Where "selected" corresponds to a list of objects
then in your component you will have these 2 actions
rowIdentity = (row: any) => {
return row.id;
}
then you must specify what will be the identity column of each row with row identity
don't forget to declare it in
The key is that you will have 2 lists: one for selected and one that corresponds to the data table. Then the objects you want to appear selected should be inserted in the selected list. In this way the library detects based on the selected list which should be marked by default in the table all this thanks to rowIdentity
If you want to add a select all must add an extra column with the following properties
<ngx-datatable-column
[headerCheckboxable] = true
[checkboxable] = "true"
>
</ ngx-datatable-column>
<ngx-datatable class="material" [rows]="quoteItem" [columnMode]="'force'" [headerHeight]="50" [footerHeight]="50" [rowHeight]="'auto'" [limit]='5' [externalSorting]="true" [loadingIndicator]="loading" (sort)="onSort($event)" [selected]="selected" [selectionType]="'checkbox'" (activate)="onActivate($event)">