php - I would like to access DataTables **cell** with click function in Laravel 5.4 -


i have laravel 5.4 application working on. contains, off course, forms have input fields next search button. when user clicks on search button modal windows appears datatable content fetched database.

now, achieve once click on cell of table, picks specific data in cell , fetch input field close modal window using jquery.

here code.

  1. datatable:

            $('#mere-table').datatable({         processing: false,         serverside: true,         ordering: false,         ajax:'http://127.0.0.1:8000/nouveau_ne/data_meres',         columns :[             {data : 'nnid', name:'t_individus.nnid', classname:"nnid_mere"},             {data : 'nom', name:'t_individus.nom'},             {data : 'postnom', name:'t_individus.postnom'},             {data : 'prenom', name:'t_individus.prenom'},                  ]         }); 
  2. jquery pick data cell , fetch inputfield nnid_mere

              $('#mere-table').datatable().on('click','.nnid_mere', function(){                                    alert('ok'+$('.nnid_mere').text());                                    }); 

what code after click on cell, alert picks data column nnid. want 1 cell, not full column not know how go not great in jquery.

how can achieve this? , tips appreciated

store datatable instance in variable :

var table = $('#mere-table').datatable({ .. }) 

then simply

$('#mere-table').on('click','.nnid_mere', function(){   console.log( table.cell(this).data() ) }); 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -