Laravel-datatables: Tooltip on Buttons in Columns

Created on 8 Sep 2016  ·  3Comments  ·  Source: yajra/laravel-datatables

Hello, one more request from me:

I would like to have Bootstrap Tooltips on Buttons in an -> addColumn (who explain the icons).

Same Code then last time :-)

`
return Datatables::of($listquery)
->addColumn('action', 'teams.action')
->make(true);

i load here a extra page with the condition, and the buttons

`

@can('team.admin') <a href="/myteams/teammemberlist/{!! $teamid !!}" class="btn btn-xs btn-primary"> <i class="fa fa-pencil-square"></i> </a> @endcan

The Bootstrap Code looks like this:

<a href="/myteams/teammemberlist/{!! $teamid !!}" class="btn btn-xs btn-primary" data-toggle="tooltip" title="edit the row!"> <i class="fa fa-pencil-square"></i> </a>

Normalous i do the javascript code at the bottom of the template
<script> $(document).ready(function(){ $('[data-toggle="tooltip"]').tooltip(); }); </script>

System details

How can i get this working in datatables?

System details

i use homestead on windows for development

OS: Windows 10
PHP: 7.0
Laravel Version: 5.2
DB: mysql on (actual) homestad machine

question

Most helpful comment

@jgatringer you need to add the tooltip js on drawCallback or draw.dt event of DataTables.

$('table').on('draw.dt', function() {
    $('[data-toggle="tooltip"]').tooltip();
})

All 3 comments

@jgatringer you need to add the tooltip js on drawCallback or draw.dt event of DataTables.

$('table').on('draw.dt', function() {
    $('[data-toggle="tooltip"]').tooltip();
})

Yes. Thanks a lot! Looks great now.

How to escape row title attribute for tooltip ? Or How to add tooltip to row ? or make our own using div ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

macnux picture macnux  ·  3Comments

alejandri picture alejandri  ·  3Comments

nasirkhan picture nasirkhan  ·  3Comments

shadoWalker89 picture shadoWalker89  ·  3Comments

FilipeBorges1993 picture FilipeBorges1993  ·  3Comments