jQuery dataTable and FancyBox

Just a short note as an addon to my post some time ago about fancybox and ajax: in case a you have a table where one of the columns contains links to fancybox popups or something like that and this table is also wrapped into jQuery dataTables, do the init of fancybox prior to init of dataTables, since if you do dataTables first, all elements that are not on the current page will not be properly initialized with fancybox and thus, the links will be broken if you navigate to the next page of dataTable.

The point is that when dataTable is initiated, all elements that do not fit on a single page of a table are hidden via removal from DOM and thus not visible for fancybox init function, while if you do other way around, first fancybox is correctly set to all elements in the table and then hidden elements are removed, so when you change a page and elements are inserted back – they are already inited with fancybox and will work perfectly well.

1 thought on “jQuery dataTable and FancyBox”

Leave a Reply