Link for Export Instead of Button

Link for Export Instead of Button

ashebashistrashashebashistrash Posts: 4Questions: 1Answers: 0

I'd like to create a kebab menu which contains the print, copy, excel, pdf options.

How do I convert the actions assigned to these buttons into links?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    If we take this example, do you mean you want the <button> elements to be <a> instead? I'm not clear on what the advantage of that is, but if that is what you want to do use:

    DataTable.Buttons.defaults.dom.button.tag = 'a';
    

    before you initialise the DataTable.

    Allan

  • ashebashistrashashebashistrash Posts: 4Questions: 1Answers: 0

    Sorry not sure I asked my question correctly. This is just for aesthetics as the buttons do not look pleasing on my page.

    I want to utilize the copy, excel, pdf and print features but I want execute them in a kebab style menu.

    I suppose what I really need is to understand how to link my menu to execute the functions tied to the buttons

  • colincolin Posts: 15,112Questions: 1Answers: 2,583
    Answer ✓

    This thread should help, particularly this example. It's showing how you can call the button's action() script within your kebab menu, without having the DataTables button on the page.

    Colin

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Check out this example. It doesn't use the export buttons, but they could easily be put into the dropdown and you could readily style the main button with a kebab icon.

    Allan

  • ashebashistrashashebashistrash Posts: 4Questions: 1Answers: 0

    Hey Colin,

    That's exactly what I'm looking for and should be extremely easy to implement but I can't see to get it to work. I created a test button just to make sure I could call the action before wasting time, sadly nothing happens when the button is click.

    If I add B to my doms the pdf export button works, so I'm assuming the script I'm using has the correct extensions.

    Here's the code I have after my table close tag.

  • ashebashistrashashebashistrash Posts: 4Questions: 1Answers: 0

    nvm I solved it. Forgot I'm calling a variable (table) but I didn't have the variable assigned

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Thanks for the update. Good to hear you have it working now.

    Allan

Sign In or Register to comment.