TollTips with ajax

TollTips with ajax

jfrjfr Posts: 71Questions: 24Answers: 0

Hi all.

Does any one has and example of a tooltips formatting working with ajax load of large data, more than 1 page.
The title is easy to create in rowCallback and nRow.setAttribute( 'title', title);
But formatting it for more than the first
/* Apply the tooltips */
$('#example tbody tr[title]').tooltip( {
"delay": 0,
"track": true,
"fade": 250
} );
even putting it in initComplete or coding it in jQuery('#example').on('init.dt', function()

I have tried with rows().nodes() but the title is only present for the first page

Any help would be appreciated
Thanks in advance

Replies

  • MisiuMisiu Posts: 68Questions: 4Answers: 2

    could You link to example page where we could try to fix that? jsbin or jsfiddle is fine.

  • jfrjfr Posts: 71Questions: 24Answers: 0
    edited September 2014

    I have change the tooltip construction from rowCallback to drawCallback with a class of hasTip so we do not override the already applied toolTip

    example for jquery.powertip.js

    "drawCallback": function( settings) {
        if (settings.aoData.length > 0) {
            /* tooltips here for pages not yet rendered */
            var vNodes = this.api().rows( {page:'current'} ).nodes();
            jQuery.each(vNodes, function(index, value) {
                if (!jQuery(vNodes[index]).hasClass( "hasTip" )) {
                    var vNodesData = vNodes.data();
                    var title = '<p><b>ToolTip Menu for' + vNodesData[index].saleman + ' ' + vNodesData[index].name + '</b></p>' +
                        '<p><a href="../link1.html?parm1=x&parm2=y'" target="_blank">link 1 title</a></p>' +
                        '<p><a href="../link1.html?parm1=x&parm2=y'" target="_blank">link 1 title</a></p>';
                    vNodes[index].setAttribute( 'title', title);
                    jQuery(vNodes[index]).powerTip({
                            placement: 's',
                            smartPlacement : false,
                            mouseOnToPopup: true});
                    jQuery(vNodes[index]).addClass( "hasTip" );
                }
                })
            }
    }
    
This discussion has been closed.