Colorbox / Thickbox class not getting applied
Colorbox / Thickbox class not getting applied
I am using very basic integration of datatables but loading the data using ajax (ssp-class). The data is coming fine. I am applying colorbox / thickbox class to a specific col for eg. I have that col coming like this: <a href='sys.php' class='thickbox'>Somethign</a> its coming fine but upon clicking the thickbox / colorbox is not working and it loads the target page. Can anyone please shed some light as to why the colorbox / thickbox is not triggering ? P.S thickbox / colorbox is working outside of datatables on the same page as datatables.
This question has an accepted answers - jump to answer
Answers
don't see your code, hard to tell.
Reason might be that the element you are applying the class to doesn't exist in the dom yet at the time you are applying it.
You might want to use an event for it to make sure the data table is ready when the class is being applied. "on init" could be the right one:
https://datatables.net/reference/event/init
Hi,
my code is following:
Ajax sends this code for colorbox / thickbox link:
<center><a class='thickbox' href='../pictures/" . $d . "'><i class='fa fa-picture-o' aria-hidden='true'></i></a> <input type='radio' name='pid' value=" . $d . " /></center>
Can anyone please shed some light as to why thickbox / colorbox class is not applying where as font awesome is working fine ?
Thanks.
Try with an event:
Hi,
thanks it kind of works for only the 1st page in datatables, if i search for something or goto any other page then it is not working. Any suggestion ?
Thanks.
check the data tables event list and try some other events.
Candidates to try would be "on preDraw" or "on draw". Maybe "on page". Easy to try it ...
https://datatables.net/reference/event/
https://datatables.net/reference/event/preDraw
https://datatables.net/reference/event/draw
https://datatables.net/reference/event/page
Hi,
draw event works fine.
Thanks.