0

I'm using jQuery DataTables plugin to construct tables and use the sDom option to have "Export to Excel" functionality with the .swf (copy_csv_xls.swf) file.

I build the table and this functionality works find without any issues. The issue comes when I use them in "tabs". I use Bootstrap vertical tabs and have a datatable in each tab. Whenever the tab is clicked, I had to reDraw the tables because of the alignment problem. I believe the "reDraw" is not creating issue. What happens is, when the data is populated in "Tab 1" with "Tab 1" being active, the "Export" works, but if the data is populated in "Tab 2", then the "Export" in Tab 2 doesn't work. The event itself is not firing.

Can anyone please tell me what would be the issue? Is there a solution or alternate option for this?

enter image description here

Gyrocode.com
  • 57,606
  • 14
  • 150
  • 185
superachu
  • 823
  • 3
  • 16
  • 34
  • 1
    see this -> **http://iksela.tumblr.com/post/3445022287/using-jquery-ui-tabs-and-datatables-tabletools** and this -> **https://datatables.net/forums/discussion/3783/issue-with-tabletools-2-0-on-hidden-tabs** – davidkonrad Sep 01 '15 at 20:43
  • Thanks @davidkonrad.. it worked fine after using the code given in the link you provided. – superachu Sep 02 '15 at 13:21
  • Can you please add solution suggested by @davidkonrad that worked for you as an answer so others could benefit from it? – Gyrocode.com Sep 04 '15 at 16:44
  • From the link http://iksela.tumblr.com/post/3445022287/using-jquery-ui-tabs-and-datatables-tabletools, one of the post has the following code which I used in my application and it worked $(function () { $("#tabs").tabs({ activate: function(event, ui){ var ttInstances = TableTools.fnGetMasters(); for (var i in ttInstances) { if (ttInstances[i].fnResizeRequired()) ttInstances[i].fnResizeButtons(); } } }); } – superachu Sep 04 '15 at 17:48
  • 1
    Please add this solution as an answer, not as a comment. – Gyrocode.com Sep 04 '15 at 18:44
  • 1
    @Gyrocode.com, sounds like really good idea - after all it is the whole point with stackoverflow :) – davidkonrad Sep 04 '15 at 19:14
  • 1
    @davidkonrad, if you can post that in answer, I can mark up as "answer" – superachu Sep 04 '15 at 19:26
  • Ésta puede una solución a tu problema. http://stackoverflow.com/questions/11848593/datatables-tabletools-multiple-tables-on-the-same-page – Angelinhojavier Nov 13 '15 at 05:05

0 Answers0