thickbox on server side

thickbox on server side

tahatra21tahatra21 Posts: 3Questions: 0Answers: 0
edited October 2011 in General
hi all,

i'm newbie in programming, i'm try to call thickbox function but the server side not working, maybe some body can help me to solve this,

[code]
while ( $aRow = mysql_fetch_array( $rResult ) )
{
$row = array();

/* Add the details image at the start of the display array */
$row[] = '';

for ( $i=0 ; $i
[/code]

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    edited October 2011
    I would recommend doing the thickbox set-up on the client side and leaving the server-side data "pure"

    to do this, your column definition for "Version" ("Number") on the client side could have an fnRender function that converts the value to the anchor you desire.

    then in a callback (fnDrawCallback probably ideal) you call thickbox on the desired selector to attach thickbox's behavior to that link

    [code]
    $('#yourtable').dataTable( {
    "aoColumns": [
    { }, // other columns
    { }, // other columns
    {
    "sName": "Number",
    "fnRender": function (oObj) {
    return ""+oObj.aData[oObj.iDataColumn ]+"";
    }
    }
    ],
    "fnDrawCallback": function() {
    $('.thickbox').thickbox(); // or however you attach thickbox
    }
    });
    [/code]
  • tahatra21tahatra21 Posts: 3Questions: 0Answers: 0
    thx fbas for ur help, but i'm still didn't understand, i was put thickbox class on my client but that still not call the thickbox function, any idea? :D

    [code]
    $(document).ready(function() {
    $('#TableIncident').dataTable( {
    "sScrollX": "100%",
    "sScrollXInner": "150%",
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "server-side-incident-online.php",
    "bAutoWidth": false,
    "sPaginationType": "full_numbers",
    "bDestroy": true,
    "aoColumnDefs": [
    {
    "sName": "Number",
    "fnRender": function ( oObj ) {
    return ''+oObj.aData[0]+'';
    },
    "aTargets": [ 0 ]
    },
    ],
    "fnDrawCallback": function() {
    $('.thickbox').thickbox(); // or however you attach thickbox
    }
    } );
    [/code]
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    If you change:

    [code]
    $('.thickbox').thickbox();
    [/code]

    to

    [code]
    alert( $('.thickbox').length );
    [/code]

    what do you get? If its "0" then the selector isn't picking up any elements to apply thickbox to.

    Allan
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    edited October 2011
    You might have to use a different package than thickbox. I'm not too familiar with thickbox, but looking at the demos on the site, I'm guessing that there is no .thickbox() routine to call to attach thickbox to your elements, which implies to me that binding is only done at document.ready and won't work for dynamic content.

    also thickbox is no longer supported. http://jquery.com/demo/thickbox/

    Personally I prefer fancybox. http://fancybox.net/

    [code]$(document).ready(function() {
    $('#TableIncident').dataTable( {
    "sScrollX": "100%",
    "sScrollXInner": "150%",
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "server-side-incident-online.php",
    "bAutoWidth": false,
    "sPaginationType": "full_numbers",
    "bDestroy": true,
    "aoColumnDefs": [
    {
    "sName": "Number",
    "fnRender": function ( oObj ) {
    return ''+oObj.aData[0]+'';
    },
    "aTargets": [ 0 ]
    },
    ],
    "fnDrawCallback": function() {
    $('.fancybox').fancybox(); // fancybox uses function to attach, which allows you to control when/where to attach fancybox to your link or DOM element
    }
    } );
    [/code]
  • tahatra21tahatra21 Posts: 3Questions: 0Answers: 0
    @allan and fbas , thx for ur all help, yap i getting "0" for the result and like fbas said thickbox not supported to dynamic content. After i trying that fbas post to using a fancybox its working well now, so thx fbas :D
    but before i see ur post i was trying to use popup window, thats working well too like this

    [code]
    $(document).ready(function() {
    $('#Mytable').dataTable( {
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "server-side.php",
    "bAutoWidth": false,
    "sPaginationType": "full_numbers",
    "bDestroy": true,
    "aoColumnDefs": [
    {
    "sName": "Number",
    "fnRender": function ( oObj ) {
    return ''+oObj.aData[0]+'';
    },
    "aTargets": [ 0 ]
    },
    { "sName": "field2", "aTargets": [ 1 ] },
    { "sName": "field3", "aTargets": [ 2 ] },
    { "sName": "field4", "aTargets": [ 3 ] },
    { "sName": "field5", "aTargets": [ 4 ] },
    { "sName": "field6", "aTargets": [ 5 ] }
    ],
    } );

    [/code]

    Thx all for ur help :)
This discussion has been closed.