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

253
Visualizações
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 à 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