Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7625223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:09:47+00:00 2026-05-31T05:09:47+00:00

So basically I am using jQuery Datatables server-side functionality with PHP to retrieve a

  • 0

So basically I am using jQuery Datatables server-side functionality with PHP to retrieve a table with details from MySQL as illustrated here

From the HTML side, the following jQuery script (1) references the PHP script that grabs the data from MySQL and (2) then defines the table and customizes the columns in the row details.

My problem is getting the links in the row details to collaborate with ColorBox.

Here is the script I am using:

 <script type="text/javascript" charset="utf-8">

        $(document).ready(function() {
            memTable = $('#members').dataTable( {
                "bProcessing": true,
                "bServerSide": true,
                "sAjaxSource": "detailsm.php",
                "aoColumns": [
                    { "sClass": "center", "bSortable": false },
                    null,
                    null,
                    null,
                    { "sClass": "center" },
                    { "sClass": "center" },
                    { "sClass": "center" },
                { "sClass": "center" },

                    { "sClass": "center" }
                ],
                "aaSorting": [[1, 'desc']]
            } );

            $('#members tbody td img').live( 'click', function () {
                var memTr = $(this).parents('tr')[0];
                if ( memTable.fnIsOpen(memTr) )
                {
                    /* This row is already open - close it */
                    this.src = "datatables/details_open.png";
                    memTable.fnClose( memTr );
                }
                else
                {
                    /* Open this row */
                    this.src = "datatables/details_close.png";
                    memTable.fnOpen( memTr, fnFormatMemberDetails(memTr), 'details' );
                }
            } );
        } );

        var memTable;

        /* Formating function for row details */
        function fnFormatMemberDetails ( memTr )
        {

            var mData = memTable.fnGetData( memTr );
            var smOut = '<table cellpadding="2" cellspacing="0" border="0" style="padding-left:20px;">';
            smOut += '<tr><td><b>Member Functions:</b></td><td></td><td><b>Details:</b></td><td></td></tr>';
            smOut += '<tr><td><a class="iframesmall" href="changecontact.php?userid='+mData[1]+'&fn=chusr">Update Info</a></td><td><a class="iframe"  href="notifymember.php?memberid='+mData[1]+'">Notify</a></td>'
            +'<td>Full Name: '+mData[14]+' '+mData[3]+'</td><td>Category: '+mData[11]+' | Created by: '+mData[12]+'</td></tr>';
            smOut += '<tr><td><a class="iframe" href="renewmember.php?memberid='+mData[1]+'">Renew Subscription</a></td><td><a class="iframe" href="rp.php?memberid='+mData[1]+'">Reset Password</a></td>                                   <td>Address: '+mData[15]+', '+mData[16] +', '+mData[17]+'</td><td>Mobile: '+mData[18]+'</td></tr>';
            smOut += '<tr><td><a class="iframe" href="disactivatemember.php?memberid='+mData[1]+'">Disactivate</a></td><td><a class="iframe" href="deletemember.php?memberid='+mData[1]+'">Delete</a></td>                  <td>Last Login: '+mData[10]+ '</td><td>Last Updated: '+mData[13]+'</td></tr>';
            smOut += '</table>';
            return smOut;
        }

    </script>

My ColorBox jquery script defines the class iframesmall, which is referenced above in the fnFormatMemberDetails function that formats row details for the jquery data table.

Here is the part of the code from fnFormatMemberDetails that formats my row details as you can see above:

smOut += '<tr><td><a class="iframesmall" href="changecontact.php?userid='+mData[1]+'&fn=chusr">Update Info</a></td><td><a class="iframesmall"  href="notifymember.php?memberid='+mData[1]+'">Notify</a></td>'
            +'<td>Full Name: '+mData[14]+' '+mData[3]+'</td><td>Category: '+mData[11]+' | Created by: '+mData[12]+'</td></tr>';

And here is my jQuery ColorBox script, which works on the same page when called through regular HTML (but not through HTML output via jQuery/javascript):

<link rel="stylesheet" href="colorbox/colorbox.css" />
<script src="colorbox/jquery.colorbox.js"></script>
<script>
$(document).ready(function(){
//Examples of how to assign the ColorBox event to elements
$(".photogall").colorbox({rel:'photogall'});
$(".photothumbs").colorbox({rel:'photothumbs'});
$(".iframesmall").colorbox({iframe:true, width:"800px", height:"80%"});


});
</script>

To sum it up: How do I get ColorBox to work with html links that are generated via jQuery/javascript? All suggestions are welcome. Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:09:48+00:00Added an answer on May 31, 2026 at 5:09 am

    Simply reapply colorbox() after you add the elements dinamicallhy

                else
                {
                    /* Open this row */
                    this.src = "datatables/details_close.png";
                    //here you add the data
                    memTable.fnOpen( memTr, fnFormatMemberDetails(memTr), 'details' );
                    //here you should add colorbox for the newly added elements
                    $(".iframesmall").colorbox({iframe:true, width:"800px", height:"80%"});
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently using PHP/MySQL and the jQuery timeago plugin. Basically, I need to
I'm using jQuery datatables plug-in on my HTML Table. I wanted to know how
Basically I am using jQuery ui's selectable functionality on a ul , but the
I'm trying to parse some JSON coming from an AJAX request using jQuery. Basically,
i'm using the DataTables plugin for JQuery, my problem basically lies in the fact
I've managed to confuse myself here. Basically I am using jQuery to turn a
Basically, how would I make an auto-updating mysql query result animated using jquery? I
Interested in building my own drag'n'drop file uploader using JQuery/AJAX/PHP. Basically I want a
I am using JQuery autogeocomplete and basically the lat_id and the lng_id strings are
I'm using (or trying to) JQuery Validation with WebForms/html. I have, basically (simplifying the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.