Sunday, 15 September 2013

How to display Datatable tabletools (copy, csv, excel, pdf, save) in ruby on rails -



How to display Datatable tabletools (copy, csv, excel, pdf, save) in ruby on rails -

i using datatable in ruby on rails application. follow same 1 here..

https://github.com/rweng/jquery-datatables-rails

and datatable sorting , searching working properly. can't see table tool alternative (eg - copy, csv, excel, pdf, save ) in table header.

i want show table this....

please help.

the solution add together this:

"sdom": '<"h"tcfr>t<"f"ip>'

inside javascript. work show/hide columns nicely well. if not using show/hide columns can remove capital "c".

example (with show/hide columns):

// users $("#users-datatable").datatable({ "bstatesave": true, "bjqueryui": true, "spaginationtype": "full_numbers", "bprocessing": true, "bserverside": true, "sajaxsource": $('#users-datatable').data('source'), "bscrollinfinite": true, "bscrollcollapse": true, "idisplaylength": 100, "sscrolly": "500px", "sscrollx": "100%", "sdom": '<"h"tcfr>t<"f"ip>', "otabletools": { "abuttons": [ "copy", "csv", "xls", { "sextends": "pdf", "spdforientation": "landscape", "spdfmessage": "your custom message go here." }, "print" ] } });

hopefully help someone.

ruby ruby-on-rails-3 datatable tabletools

No comments:

Post a Comment