lesimoes lesimoes - 1 year ago 148
jQuery Question

Datatables automatic get thead values for Bubble Editor (Laravel + Blades)

I use laravel 5.4 with Blades + DataTables and i would like use Bubble Editor (Datatables), like example on: https://editor.datatables.net/examples/bubble-editing/simple

But i get my theads name from Blades and not from a json. How can i get bubble editor like that?

<table id="main_grid" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
<thead id='main_grid_thead'>
@foreach($tablefields as $field)
<th>{{ $field['detail_field']['grid']['label'] }}</th>

And i got a JS Function with Datatables

var editor = new $.fn.dataTable.Editor( {
ajax: "../php/staff.php",
table: '#'+id_grid

sInfo: '',
"sDom": '<"html5buttons"B><"top"fZ>rt<"bottom"lpi><"clear"> ',
"oListNav": {
pageLength: 10,
responsive: true,


$('#' + id_grid).on( 'click', 'tbody td:not(:first-child)', function (e) {
editor.bubble( $('#' + id_grid + ' tbody tr:first-child td:first-child') );
} );

Answer Source

I found a solution

$('#' + id_grid ).on( 'click', 'tbody td i', function (e) {
 $(this).parent().children('i').attr('style','display:none; float: right;')
  editor.bubble( $(this).parent() )
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download