I think this is a rather common question. So I have used twitter bootstrap for the UI and installed datatable-rails gem for datatable. This is essentially what I did.
tradeTable = $("table#create_trades").dataTable(
"sDom": "T<'row-fluid'>t<'row-fluid'<'span6'p>>"
"bPaginate": false
"oTableTools":
"aButtons": [ "copy","csv" ]
)
$('a[href="#tab3"]').on('show', (e) ->
oTableTools = TableTools.fnGetInstance('create_trades')
if ( oTableTools != null && oTableTools.fnResizeRequired() )
oTableTools.fnResizeButtons()
)
First of all, aButtons does not limit the number of buttons. Secondly, the fnResizeButtons still wouldn’t work, after the code, the components (Copy, csv..) still have 0 width and height. I have stepped through the javascript code, and saw that fnResizeRequired() is indeed true, and fnResizeButtons() does get called. What is wrong here?
Thanks
So after all my efforts, I finally figure out how to do this. For some reason, the datatable-rails gem somehow doesn’t perform the resizing properly. But the only thing that needs to be resized is the flash component that is embeded. So what I have done basically is just to resize the components like so: