Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

192
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda