Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

187
Views
How to implement “check all” functionality on different pages that checks only current page data in angular datatable?

1) User can navigate through the table and randomly select/deselect checkboxes.

2) Clicking on "select all" checkbox in the thead should check/uncheck all the currently visible records only.

3) The "select all" button should maintain a state(checked/unchecked) for different pages of datatables. E.g. - if the user clicks select all on page 1 and navigates to next page, the Select all checkbox should be deselected and clicking it again would check all the rows in this page only while the previously selected checkboxes stays unaffected.

I have used ng2-data-table ... my code is as follow

<th style="width: 10%">
    <!--<input type="checkbox" (change)="isSelected = !isSelected" />&nbsp; Actions-->
    <mfRowSelectorHead></mfRowSelectorHead>
</th>
<tbody>
    <tr *ngFor="let item of mf.data;let ndx = index">
        <td>
            <!--<input type="checkbox" [checked]="isSelected" (change)="OnClickDeleteArray(item,check.checked)" #check />-->
            <mfRowSelector [entity]="item" [checkboxId]="ndx"></mfRowSelector>
            <span class="dropdown">
                <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    Actions
                </button>
                <span class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                    <li class="dropdown-item action-dropdown" (click)="EditModel(item)">Edit</li>
                    <li class="dropdown-item action-dropdown" (click)="DeleteModel(item,check.checked)">Delete</li>
                    <li class="dropdown-item action-dropdown">View</li>
                </span>
            </span>
        </td>
    <td>{{item.AssetModelName}}</td>
    <td>{{item.AssetModelManufacturerName}}</td>
    <td>{{item.IsActivemodel}}</td>
    </tr>
</tbody>

and code in .ts file is as follow

selectedEntities: any[];
public setSelectedEntities($event: any) {
    debugger;
    this.selectedEntities = $event;
}

Thank you in advance for taking time to read

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!