Friday, January 24, 2014

TableTools in JQuery modal bug

Hi,

It really annoyed me that DataTable-TableTools (http://datatables.net/extras/tabletools/) export to Excel button did not work on my page with Chrome and IE whereas it worked with Firefox. I digged out everything about browsers and flash support etc. Changed the code,  searched the web and everything... No solution! So I quit (a very rare situation :))...

After a while, I did use the same TableTools code on another page and it worked in all of these browsers. So I figured it out that this bug was about Jquery modal because in the first case, TableTools table was placed in a modal. I did a refined search and immediately found this:

$('.dialog').dialog({
                    modal: true,
                    zIndex: 1
                });
 
 
"JQuery UI has a bug where if ran in a modal, it removes the click functions from certain elements due to its default z-index."


I added this extra property: zIndex: 1 to my problematic page and it worked like a charm.

Cheers,



No comments:

Post a Comment