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

118
Vistas
Tabulator: autoColumnsDefinitions using custom cell formatter and dynamically defined fields?

I have an ajax Tabulator in which I'd like to use a custom cell formatter on columns which are dynamically (but similarly) defined.

Let's say I have a dataset of People with "Event" columns, where the ajax response can contain up to 50 Event fields, named Event1,Event2...Event50. I could manually repeat the definitions using the Column Definition Array or Field Name Lookup Object approaches, like:

    autoColumnsDefinitions:{
        PersonID: { title:"ID #", align:"right"},
        Event1: {formatter: eventFormatter},
        Event2: {formatter: eventFormatter},
        ...[variable # of Event cols here]...
    },

...

   function eventFormatter(cell){
      // format event here
   }

However, using a callback seems more appropriate. When I try something like this, my eventFormatter is never invoked, and no errors or warnings are raised.

    autoColumnsDefinitions:function(definitions){
        definitions.forEach((column) => {
            if(column.field.match(/Event/)) {
                column = {
                    formatter:eventFormatter
                }
            }

Is it possible to apply a custom cell formatter to fields that are not explicitly named prior to data loading?

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

0

Your must update 'column' with formatter as

autoColumnsDefinitions: function (definitions) {
  return definitions.map((column) => {
    if (column.field.match(/(name|title)/)) {
      column.formatter = titleFormatter;
    }
    return column;
  });
}

See JSFiddle

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