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

243
Vistas
Tabulator: reformat cell on 'cellEdited' event

I am new at using Tabulator.js but I am willing to learn and use it deeply. I was indeed looking for a good tableGenerator library for a main project. So far, it seems to be pretty nice. I am currently using a CND link for version 5.0.7.

Now here is my problem: I try to format cell with a background-color depending on the cell value (the cell name is status and the value can be either true or false). It works at the creation of the table. But it doesn't work if I change the cell value afterwards.

I created a method called statusFormatter:

statusFormatter: (cell) => {

        if (cell.getValue() == true) {
            cell.getElement().style.backgroundColor = "#A6A6DF";
        }

        return cell.getValue();
},

I call this method on the cellEdited event:

mainTable.on("cellEdited", function (cell) {
    clientTabulator.statusFormatter(cell);
});

I suppose there is something wrong with the return in the method. But I don't know what to return when it is the style that I need.

Hope someone can help...

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Change your statusFormatter function as

statusFormatter: function (cell, formatterParams, onRendered) {
  
  let position = cell.getRow().getPosition();

  // switch row even and  odd color
  let backgroundColor = cell.getValue() ? "#A6A6DF" : position % 2 ? "#efefef" : "#fff";
  cell.getElement().style.backgroundColor = backgroundColor;

  return cell.getValue();

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