Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

138
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda