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

390
Views
¿Cómo filtrar las filas seleccionadas en la cuadrícula AG y mantenerlas como seleccionadas?

Quiero filtrar las filas de mi cuadrícula AG en función de la selección de la casilla de verificación y quiero mantenerlas como seleccionadas.

Sé que usando el método a continuación puedo filtrar las filas seleccionadas, pero después de filtrar las filas pierden su estado seleccionado.

 gridOptions.api.setRowData(gridOptions.api.getSelectedRows())

Puedo ejecutar gridoptions.api.selectAll() pero tengo que evitarlo porque no quiero que se active el evento de cambio de selección de cuadrícula AG.

¿Alguna idea de cómo puedo lograrlo?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use el filtro ag-grid externo para filtrar las columnas a mano. En la definición de fila, establezca el filtro para las filas en verdadero. Anule los métodos isExternalFilterPresent y doesExternalFilterPass de ag-grid en HTML

 <ag-grid-angular [columnDefs]="columnDefs" [isExternalFilterPresent]="isExternalFilterPresent" [doesExternalFilterPass]="doesExternalFilterPass" [rowData]="rowData" (gridReady)="onGridReady($event)" ></ag-grid-angular>

en .ts defina fuera de su componente (o hágalo estático)

 // Used in isExternalFilterPresent() to detect if (external)filter is active or not let Gobal_filterSelectedDocuments: boolean;

y en tu componente

 onToggleDocumentsFilterClick(event: MatSlideToggleChange) { Gobal_filterSelectedDocuments = event.checked; // nesseary notification to enable the filter this.gridApiObjects.onFilterChanged() } isExternalFilterPresent() { // Here we have no access to the 'this.' of the component. Use a Global Variable instedt. return Gobal_filterSelectedDocuments; } doesExternalFilterPass(node) { // Show only selected nodes return node.isSelected(); }

El mayor problema es que isExternalFilterPresent() tiene un alcance diferente y this. es un objeto angular (gridapi?) No el componente actual. Así que necesitaba una variable global/estática para solucionar esto.

about 4 years ago · Juan Pablo Isaza Report
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!