Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

188
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda