Shadowbox with server-side script

Shadowbox with server-side script

JerrysJerrys Posts: 13Questions: 2Answers: 0
edited October 2012 in General
Hello,

I have one problem with shadow box with server-side script.

I should retrive a big amound of data from database, and shuold have a link, which I prefered that it's opened throught shadowbox script.

When I write the link in to page it works great, but when I create a server-side script, and return the same link (with shadow box) it's don't work.

In parent document I use:

[code]


Shadowbox.init();
[/code]

In server side script I use this:

[code]
$row[2] = "$link";
[/code]

But if I write the link in parent document it's work:
[code]
echo "link";
[/code]

But if I try from server-side script, it's don't work :(

May bee you could help me?


Thank you

Replies

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    There is an FAQ on this: http://datatables.net/faqs#ss_events

    Allan
  • JerrysJerrys Posts: 13Questions: 2Answers: 0
    May bee you could show a little example, cause I don't understand how to use $.live ?
    Thank you
  • JerrysJerrys Posts: 13Questions: 2Answers: 0
    I'll try to use .live, but it's still doesn't work.

    I only needed, that when datatables config a table, show a link, witch opened in shadowbox.
    I'll try write fnDrawCallback but it's still doesn't work :(
    Please help me :)
    [code]
    function startas()
    {
    $('#example tbody tr').live('click', function() {
    var aData = oTable.fnGetDate( this );
    var id = aData[2];
    alert( id );
    //shadowbox(id);
    });
    }
    function shadowbox(linkas)
    {
    location.href=linkas + 'html' + ' rel="shadowbox;width=1000;height=800"';
    }
    [/code]

    and
    [code]
    "fnDrawCallback": function() { startas(); },
    [/code]
  • JerrysJerrys Posts: 13Questions: 2Answers: 0
    Now I'll try to ryte this callback,
    but and this doesn't work :(

    [code]

    var oTable = $('#example').dataTable( {
    "sDom": 'TC<"clear">lfrtip',
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "auditas_ajax.php",
    "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull )
    {

    $('td:eq(2)', nRow).html( ''+aData[2]+'' );
    },

    [/code]
  • JerrysJerrys Posts: 13Questions: 2Answers: 0
    I found a solution:

    [code]
    //shadowbox initializing

    Shadowbox.setup($('.sbox'));
    $('a.sbox').live('click', function(e) {
    Shadowbox.open(this);
    e.preventDefault();
    });
    //datatables

    var oTable = $('#example').dataTable( {
    "sDom": 'TC<"clear">lfrtip',
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "auditas_ajax.php",
    "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull )
    {
    $('td:eq(2)', nRow).html( ''+aData[2]+'' );
    },
    "aoColumnDefs": [
    { "bSortable": false, "aTargets": [ 0 ] },
    { "bSortable": true, "aTargets": [ 1 ] },
    { "bSortable": false, "aTargets": [ 22 ] },
    { "bVisible": false, "aTargets": [ 3 ] },
    { "bVisible": false, "aTargets": [ 4 ] },
    { "bVisible": false, "aTargets": [ 5 ] },
    { "bVisible": false, "aTargets": [ 6 ] },
    { "bVisible": false, "aTargets": [ 7 ] },
    { "bVisible": false, "aTargets": [ 8 ] },
    { "bVisible": false, "aTargets": [ 9 ] }
    ],
    "aaSorting": [[1, 'asc']]
    });

    [/code]

    And it's work perfect, how I understand the shadow box should initializing a leter than datatables.
This discussion has been closed.