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

145
Views
Cómo actualizar su base de datos desde un enlace de acción tabulador

Estoy tratando de enviar los datos de la fila de mi tabulador a mi servidor porque quiero eliminarlos de mi base de datos al hacer clic en el onClick de distribución, pero parece que no puedo resolverlo. He agregado una función de búsqueda que debe publicarse en la ruta expresa especificada que no recibe esa solicitud. Alguien amablemente hágamelo saber cómo resolver esto

Aquí está mi etiqueta de script:

 function btnFormatter( cell, params, onRendered ) { var element = document.createElement('button'); var link = document.createElement('a') link.textContent = 'Distribute' link.className = "button-link" element.appendChild(link) onRendered( function() { element.addEventListener('click',()=>{ var id = cell.getData().id const data = cell.getRow().getData() fetch('http://localhost:3000/delete/marketing', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) }) return element; } var table = new Tabulator(".table", { height:'auto', // set height of table (in CSS or here), this enables the Virtual DOM and improves render speed dramatically (can be any valid css height value) ajaxURL:'/marketing.json', //load data layout:"fitColumns", //fit columns to width of table (optional) columns:[ //Define Table Columns {title:"Customer Name", field:"name"}, {title:"Commodity", field:"commodity",headerFilter:'input'}, {title:"Quality", field:"quality",headerFilter:'input'}, {title:"Quantity", field:"quantity"}, {title:'Action',formatter:btnFormatter} ], // rowClick:function(e, row){ //trigger an alert message when the row is clicked // alert("Row " + row.getData().id + " Clicked!!!!"); // }, });

Y mi ruta express:

 router.post('/delete/marketing',(req,res)=>{ console.log(req.body) // connection.query('DELETE FROM order_table WHERE id = ?', req.body.id,(error,results)=>{ // if(error){ // console.log('error') // } else { // console.log('item deleted') // } // }) })
about 4 years ago · Juan Pablo Isaza
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!