Two separate jQuery scripts clashing?

Two separate jQuery scripts clashing?

redmanstandingredmanstanding Posts: 4Questions: 0Answers: 0
edited October 2013 in DataTables 1.9
Hi, I love the datatables software but I've hit a hurdle after searching the forum high and low for a solution. What it is, I have the dataTables script and a YouTube popup script on the same page and understand from what I've read that I might need to include jQuery.noConflict() for both of them to work on the same page. As you can see below, I have a a href class on the link but when I click it, it just leads me to the actual YouTube page and doesn't trigger the youtubepopup script to function on the page. I've also read that http://datatables.net/examples/advanced_init/row_callback.html would work for this but unsure how to implement it here:

[code]




$(function () {
$("a.youtube").YouTubePopup({ 'autoplay': 1, 'hideTitleBar': true });
});

$('#tr').fadeIn();

$(document).ready(function() {
$('#example').dataTable( {
bProcessing: true,
bServerSide: true,
sPaginationType: 'full_numbers',
bJQueryUI: true,
sAjaxSource: 'server_processing.php',
aoColumns:[
null,
null,
null,
{ bSearchable: false, bSortable: false, fnRender: function (oObj) { return '';
}

}
],
} );
} );
[/code]

I hope someone with more knowledge can help me please. Thanks in advance.

Replies

  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    Use fnDrawCallback and run the YouTube plug-in script in that - not separately. At the moment its running before DataTables has loaded any data!

    Allan
  • redmanstandingredmanstanding Posts: 4Questions: 0Answers: 0
    Thanks so much Allan. Much appreciated. :) Got it working by adding fnDrawCallback with the youtubepopup in the function, as you said.

    [code]




    $(document).ready(function() {
    $('#example').dataTable( {
    "bProcessing": true,
    "bServerSide": true,
    "sPaginationType": 'full_numbers',
    "bJQueryUI": true,
    "sAjaxSource": 'server_processing.php',
    aoColumns:[
    null,
    null,
    null,
    { bSearchable: false, bSortable: false, fnRender: function (oObj) { return ''; }}
    ],
    "fnDrawCallback": function() {
    $("a.youtube").YouTubePopup({ autoplay: 1, hideTitleBar: true });
    }
    } );
    } );
    [/code]
This discussion has been closed.