Tooltipster with Datatable

Tooltipster with Datatable

DevilsGraveDevilsGrave Posts: 20Questions: 6Answers: 0

Hello. I just started using datatables and I have to say it's one of the best (if not the best) apps ever used by me.

I am using Tooltipster (http://iamceege.github.io/tooltipster/) for my tooltips on hover. Now how do I integrate these in my datatable? I need to have tooltips with information on certain columns. The data source is a json object array.

This is my js

$('#tblCurrentEnrollments').dataTable({
"bAutoWidth": false, // Disable the auto width calculation
"lengthMenu": [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]],
"aaData": currentEnrollments,
"aoColumns": [
{
"mDataProp": "Course.course_title",
"sWidth": "30%"
},
{
"mDataProp": "_Class.class_title",
"sWidth": "30%"
},
{
"mDataProp": "EnrollmentResults.enrollment_results_title",
"sWidth": "20%"
},
{
"mDataProp": "ecommerce_time",
"sWidth": "20%"
}
]
});

How do I get a Tooltip on the first column? Basically I need to add a div tag to the first column.

Thanks.

Answers

  • DevilsGraveDevilsGrave Posts: 20Questions: 6Answers: 0

    Ok I got it to work but it's not working on the next page.

    $('#tblCurrentEnrollments').dataTable({
    "bAutoWidth": false, // Disable the auto width calculation
    "lengthMenu": [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]],
    "aaData": currentEnrollments,
    "aoColumns": [
    {
    "mDataProp": "Course.course_title",
    "sWidth": "30%",
    "mRender": function (data, type, full) {
    tipDesc = "Test";
    tipDesc += "

    Click this link

    ";
    tipDesc += "

    image

    "

                            return '<div class="demo-interact" title="' + tipDesc + '">' + data + '</div>';
                        }
    
                    },
                    {
                        "mDataProp": "_Class.class_title",
                        "sWidth": "30%"
                    },
                    {
                        "mDataProp": "EnrollmentResults.enrollment_results_title",
                        "sWidth": "20%"
                    },
                    {
                        "mDataProp": "ecommerce_time",
                        "sWidth": "20%"
                    }
                ]
            });
    

    What can I do to make it work on all pages?

    Thanks.

This discussion has been closed.