Search code examples
laraveltooltipyajra-datatable

How to change <th> tooltip on Laravel DataTables


I use Yajra DataTables for Laravel and pass my column properties like this:

        [
            'name' => 'remind_me',
            'title' => '<i class="fa fa-envelope"></i>',
            'data' => 'remind_me',
        ]

The resulting <th> shows the icon as required, but on hovering a tooltip pops up, showing the title in raw html.

I want this tooltip to show some text, like 'remind me'. I'm not sure where this tooltip gets generated, but hoped it'd be as easy as adding another attribute like 'tooltip' => 'remind me'. However I can't find this option on https://datatables.net/reference/option/columns

So my question is: how can I change the text on the autogenerated tooltip?


Solution

  • just saw it at the source code of Yajra Datatables, use:

    "titleAttr"

    Example:

           [
                'name' => 'remind_me',
                'title' => 'Title',
                'titleAttr' => 'Tooltip!'
                'data' => 'remind_me',
            ]