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

397
Vistas
"setColumnDefs" is not working on version 26.1.0 (Angular)

I have an angular project that uses Ag-Grid and here is my problem.

I thing that I have tried all that is in my hand but I'm not able to make it work... My code needs to add and remove some Columns dynamically, and in the documentation I saw that setColumnDefs from the GridApi was a good idea to try it.

I don't know If I'm doing something wrong, but I tried to follow the docs as much as I can.

This is the method that updates the columns definitions (it doesn't work)

updateColumnsMode(): void {
  if(!this.showAdvancedColumns) {
    this.gridOptions
        .api!
        .setColumnDefs(this.buildColumns(this.advancedColumnsName)));
  } else {
    this.gridOptions
        .api!
        .setColumnDefs(this.buildColumns(this.normalColumnsName)));
  }
}

My grid Options

gridOptions: GridOptions = {
  rowData: this.rowData,
  columnDefs: this.buildColumns(this.normalColumnsName),
  onGridReady: (event:any) => console.log("Grid working!"),
}

And the api initialization

onGridReady(params: any) {
  this.gridApi = params.api;
  this.gridColumnApi = params.columnApi;
}

And if it could be relevant, the method where I build the columns

buildColumns(columnsToBuild: String[]): ColDef[] {
  return columnsToBuild.map((column):any => {
    return { "field": column, sortable: true, filter: true }
  });
}

The columnsToBuild is jut an array of String.

I really need help with this guys.

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