Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
Tabulador agregar una nueva fila y editar contenido

Tengo la siguiente configuración de tabulador:

 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" });

Además, registro una función para insertar una nueva fila:

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

Cuando llamo a la función insertRow() , puede insertar una nueva fila en la tabla pero no abrir la edición de la primera celda.
Sin embargo, el siguiente código funciona:

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

En la documentación http://tabulator.info/docs/4.9/update ,

El método addData devuelve una promesa, esto se puede usar para ejecutar cualquier otro comando que deba ejecutarse después de que los datos se hayan cargado en la tabla. Al ejecutarlos en la promesa, se asegura de que solo se ejecuten después de que la tabla haya cargado los datos.

Entonces, parece que no podemos llamar a rows[0].getCell("name").edit() inmediatamente dentro de la promesa.
¿Es esto correcto?
¿Hay algún problema con mi código?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Si solo está agregando una fila, use la función addRow en lugar de la función addData :

 table.addRow({name: "", ip: ""], true) .then(function(row){ rows.getCell("name").edit(); });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!