TableTools copy/csv/excel/pdf buttons not working ...

TableTools copy/csv/excel/pdf buttons not working ...

rob morningrob morning Posts: 30Questions: 7Answers: 1

I have a grails intranet application (so can't provide access to but could possibly supply stripped down project ? ..) which uses DataTables and TableTools .. I also use sbAdmin template (http://startbootstrap.com/template-overviews/sb-admin/) .. My datatables render fine with paging and searching .. The table tools render BUT only the print works .. I've seen the conversations regarding the location of the swf file and I can see it being loaded when I load a table with the tools attached but nothing seems to happen when I push a button .. I'm using DataTables 1.10.7 , TableTools 2.2.4 .. Is there anything I can debug - I can't see any activity when a button is pushed .. Thanks

Replies

  • rob morningrob morning Posts: 30Questions: 7Answers: 1

    Well I got a little further and discovered a possible bug maybe ? The scenario i'm working with creates a number of datatables which are initially hidden . One is selected from a menu and is displayed .. The TableTools buttons are displayed but not active .. I tracked the problem to a function getDOMObjectPosition in dataTables.tableTools.js ..

    getDOMObjectPosition: function(obj) {
            // get absolute coordinates for dom element
            var info = {
                left: 0,
                top: 0,
                width: obj.width ? obj.width : obj.offsetWidth,
                height: obj.height ? obj.height : obj.offsetHeight
            };
    

    It seems that if the dataTable is initially created in a hidden state then the obj.width is undefined so the offsetWidth is used and this is 0 .. The result is that the buttons are displayed BUT aren't active due to the generated swf buttons having 0 height and width - changing these manually in firebug enables the corresponding buttton and enables the button .

    <div style="position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; z-index: 99;"><embed id="ZeroClipboard_TableToolsMovie_1" src="../swf/copy_csv_xls_pdf.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="0" height="0" name="ZeroClipboard_TableToolsMovie_1" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=1&amp;width=0&amp;height=0" wmode="transparent"></div>
    

    Is this a bug ? Anyone suggest a workaround ? Thanks

  • allanallan Posts: 48,908Questions: 1Answers: 7,133 Site admin

    If the table is hidden initially, then you need to call the fnResizeButtons method when it is made visible so the Flash movie can be made to fit the button area.

    Allan

  • rob morningrob morning Posts: 30Questions: 7Answers: 1

    Works ! Thanks

This discussion has been closed.