Fancybox is not working in pagination.

Fancybox is not working in pagination.

prashantbaprashantba Posts: 1Questions: 0Answers: 0
edited October 2011 in General
[code]$(document).ready(function() {
$('#example').dataTable( {
"sScrollX": "100%",
"sScrollXInner": "110%",
"bScrollCollapse": true,
"sPaginationType": "full_numbers",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "scripts/server_processing.php"
} );
$("#example #showjs").fancybox();[/code]

The fancy box is not working, Fancybox works only after setting time out for few seconds once data tables loaded.
How to set fancybox pop up for each row in data table.

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    edited October 2011
    move your call into fnDrawCallback. This callback will make sure DataTables has loaded it's data. It will also re-fire the call every time you load new data (for example, changing a page).

    [code]$(document).ready(function() {
    $('#example').dataTable( {
    "sScrollX": "100%",
    "sScrollXInner": "110%",
    "bScrollCollapse": true,
    "sPaginationType": "full_numbers",
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "scripts/server_processing.php",
    "fnDrawCallback": function () { $("#example #showjs").fancybox(); }
    } );

    [/code]

    ----

    without seeing your code, I have no idea what #showjs refers to. I'm not sure which element(s) you are attaching fancybox to within your rows. You probably want to use a class name rather than an id, since an id implies there is one single unique element you wish to find with your selector, when really your goal is to find some element in each row.
This discussion has been closed.