[solved] how to open a colorbox modal window containing content from a database?

[solved] how to open a colorbox modal window containing content from a database?

rw1rw1 Posts: 42Questions: 0Answers: 0
edited September 2012 in DataTables 1.9
hello,

i have a link in a datatables table (using the server-side example) that when clicked on i want to:

- open the colorbox modal window
- display the content (text) from the database in the modal window

i was achieving this before with the colorbox 'inline' class and hidden div solution when i was using datatables with no server side processing (ie just an html table).

it seems i cannot use this solution now though because if i add this code to the database:
[code]
link


text title
"text goes here". [link]

[/code]

it just displays the link and does not pop up the colorbox modal when clicked or know how to find the hidden div.

any help much appreciated!

thanks!

Replies

  • rw1rw1 Posts: 42Questions: 0Answers: 0
    edited August 2012
    ah, been working on this for a few hours now with no luck :( , could the following be a solution? this is from the front page of the colorbox site:

    [code]
    // Called directly with HTML
    $.colorbox({html:"Welcome"});
    [/code]

    could anyone please tell me:

    - what would i need to put in the head area of the html document?
    - what would i need to put in the database table?

    so that the link pops up the html content defined.

    my only guesses so far are something like this in the html document head area:
    [code]
    $(".test").colorbox({html:"Welcome"});
    [/code]
    and then this is the database:
    [code]
    link
    [/code]
    but that is not working - any help appreciated!

    thank you!
  • rw1rw1 Posts: 42Questions: 0Answers: 0
    i'm getting closer!

    this works when added to the database table (ie the link opens in a colorbox - woo hoo!).

    [code]
    link
    [/code]

    i just need to know how to add styling to that instance of the colorbox now!

    any ideas?

    thanks!
  • rw1rw1 Posts: 42Questions: 0Answers: 0
    edited August 2012
    i figured it out, this is complete code for a database table entry, note i've included paragraphs and links and styling in the html, most of which had to be written in the html entity form, but i've left it in below in case anyone else was wanting to add the same type of content. drum roll, this took HOURS! :)

    [code]
    link in the datatables table
    [/code]

    edit: note the styling applied to the colorbox is 50% width and 100px from the top of the page.
This discussion has been closed.