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

145
Vistas
Tabulator add a new row and edit content

I have following Tabulator setup:

var table = new Tabulator("#data-table", {
            layout: "fitColumns", //fit columns to width of table
            columns: [ //Define Table Columns
                { title: "Name", field: "name", editor:"input" },
                { title: "IP", field: "ip" },
            ],
            index:"name"
        });

Also, I register a function to insert a new row:

function insertRow(){
            table.addData([{
                name: "",
                ip: "",
            }], true).then(function(rows){
                if (rows.length == 0) return;
                rows[0].getCell("name").edit();
            })

        }

When I call the function insertRow(), it can insert a new row into the table but not open editing for the first cell.
However, following code works:

if (rows.length == 0) return;
                setTimeout(function(){
                    rows[0].getCell("name").edit();
                }, 100);

In the documentation http://tabulator.info/docs/4.9/update,

The addData method returns a promise, this can be used to run any other commands that have to be run after the data has been loaded into the table. By running them in the promise you ensure they are only run after the table has loaded the data.

So, it seem that we cannot call rows[0].getCell("name").edit() immediately inside the promise.
Is this correct?
Is there any problem with my code?

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

0

If you are only adding one row, use the addRow function instead of the addData function:

table.addRow({name: "", ip: ""], true)
.then(function(row){
   rows.getCell("name").edit();
});
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