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

245
Vistas
Laravel Yajra datatables user input values updating database values

im working on a databtable thats displaying data from my sql table. so far everything is displaying great however one of my fields needs to be able to be edited by the user and have that value updated in the database accordingly. I've been looking into multiple ways to do this but they havent been working. I've looked into form inputs,cell().edit() and onBlur from https://datatables.net but havent been able to get them to work. currently i have this for my script.

$(document).ready(function () { 
var table = $('#example').DataTable({
            serverSide: false,
            language: {
                searchBuilder: {
                    title: 'Custom Filter'
                }
            },
           dom: 'Q<"pull-left"f><"pull-right"l>rtip',
           ajax: {
                url: "{{ url('/test') }}",
                type: "GET",
                datatype: "text",
                data: {
                    q:"select * from exampleTable",
                    filename:"examplefile.json",
                    cacheInterval: 1
                }
            },
         columns: [
                {data: 'column1',title: 'column1'},
                {data: 'column2',title: 'column2'},
                {data: 'column3',title: 'column3'
               "fnCreatedCell": function (nTd, oData) {
               $(nTd).html("<input class='form-control' id='userInput' value='"+ oData.column3 +"'>");
                }},
         ],
         order: [
             [0, 'asc']
         ],

column3 in this case would be the one that shows as form field showing the current data already filled as default but can be changed. my html is in a separate blade with this.

<div class="card">
    <div class="card-header">Test Table</div>
    <div class="card-body">
        <button class="updatebutton"type="submit">Submit</button>
        <table id="example" class="table table-striped">
        </table>
    </div>
</div>

preferably It works like onBlur where they edit the line and as soon as they click off it updates the cell however I'll also take updating off the button click.

about 4 years ago · Juan Pablo Isaza
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