buttons extension

buttons extension

jnylundjnylund Posts: 10Questions: 3Answers: 0

HI, I am trying to get a basic working example of this, followed the directions and no luck.

http://jsfiddle.net/xdpb0soj/6/

What am I doing wrong?

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Check your js loading order - i.e. datatables itself before any of its extensions.

  • jnylundjnylund Posts: 10Questions: 3Answers: 0

    I tried messing with order before, no luck,

    http://jsfiddle.net/xdpb0soj/7/

  • AliBahAliBah Posts: 11Questions: 0Answers: 0

    I think you need to add editor to see these buttons.

    editor = new $.fn.dataTable.Editor( {
            table: "#example",
    
  • jnylundjnylund Posts: 10Questions: 3Answers: 0

    I dont see anything in the docs about requiring editor for buttons to work, but I tried, still no luck:

    http://jsfiddle.net/xdpb0soj/9/

  • AliBahAliBah Posts: 11Questions: 0Answers: 0

    Can you please give a link to this base example.

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    No, Editor is absolutely not required in order to use Buttons.

    Thanks for the links to the JSFiddles - there are a couple of issues:

    1. The load order - you need to load DataTables before you load its plug-ins
    2. The export buttons file hasn't been included, nor any of its dependencies.

    I would suggest using the download builder which will take care of both for you. If you want to load individual files, it also has an option for that.

    Regards,
    Allan

  • jnylundjnylund Posts: 10Questions: 3Answers: 0

    Hi, I fixed the order and added export buttons html5, and I only get copy, not the other 2 links. Does csv/excel require flash?

  • jnylundjnylund Posts: 10Questions: 3Answers: 0

    I added flash, that didn't help.

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    You will have to show your code, or preferably provide a link to a page showing your problem.

  • jnylundjnylund Posts: 10Questions: 3Answers: 0

    Sorry I thought I did, here is the latest fiddle - http://jsfiddle.net/p14p00c5/4/

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Console shows error: TypeError: $.fn.dataTable.Editor is not a constructor

    You are trying to use the Editor, but you haven't included it.

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    I've never had much luck including Flash components on JSFiddle. The HTML5 exports aren't working because the required libraries (JSZip and makepdf) aren't being included. The copy button defaults to Flash if the Flash button is available.

    Allan

  • jnylundjnylund Posts: 10Questions: 3Answers: 0
    edited September 2015

    Hi Allan, thanks for all the help, I love datatables, and you have always been super helpful. Is there a working example with the new version and csv anywhere in the world? I cant find it. I cant see why including zip library will make csvs work, but I have tried and it still doesn't work.

    Here is another try:
    http://jsfiddle.net/p14p00c5/9/

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
    Answer ✓

    http://jsfiddle.net/p14p00c5/11/

    I've removed the Flash buttons (as I said, i've never been able to get them working in JSFiddle). And I added the HTML 5 buttons and a CSV button output.

    The PDF button isn't working as the font library that makepdf requires in't being loaded, but copy, csv and excel are.

    Allan

  • jnylundjnylund Posts: 10Questions: 3Answers: 0

    Thanks,t hat works!

This discussion has been closed.