How to get "messageTop" to work with excelHtml5

How to get "messageTop" to work with excelHtml5

rdmrdm Posts: 194Questions: 55Answers: 4

I need to place a message into the body of an exported excel document and I'm not having any luck. The data table exports just fine, but I don't see the message.

I've tried this.

buttons: [
    {
        extend: 'excelHtml5',
        messageTop:'This is a test'
    }
]

I've also tried this.

buttons: [
    {
        extend: 'excelHtml5',
        exportOptions:
        {
            messageTop: 'Another test' 
        }
    }
]

What am I doing wrong? How to I get message text to appear above the exported table?

This question has accepted answers - jump to:

Answers

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974
  • rdmrdm Posts: 194Questions: 55Answers: 4

    @kthorngren -- I've already tried the example from the page you cite. I don't see any message. Even extending 'excel' instead of 'excelHtml5' has the same result. No message.

    buttons: [
        {
            extend: 'excelHtml5',
            messageTop:'This is a test'
        }
    ]
    
  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974

    I've already tried the example from the page you cite. I don't see any message.

    The example works for me. Maybe try a different browser to test?

    What browser are you using?

    Kevin

  • rdmrdm Posts: 194Questions: 55Answers: 4

    Let me clarify: when I go to the cited page, I can print from that table and see the message.

    However, then I take the same code from that page and apply it to my code, it doesn't work. Neither do I get any console errors.

  • allanallan Posts: 63,678Questions: 1Answers: 10,498 Site admin
    Answer ✓

    Make sure you are using Buttons 1.5 or newer for messageTop.

    Allan

  • rdmrdm Posts: 194Questions: 55Answers: 4
    edited February 2018

    @Allan -- How to I tell what version of Buttons I have?

    -- Disregard. I found the GitHub package and downloaded the zip file.

    Even after replacing all my Buttons js files, I'm still unable to see any messageTop content.

  • rdmrdm Posts: 194Questions: 55Answers: 4

    For good measure, I even made sure the rest of my Data Tables js files were updated. I'm still not seeing messageTop. No console error, Chrome isn't seeing anything it doesn't like.

  • rdmrdm Posts: 194Questions: 55Answers: 4

    Lacking any other option, I shut down my computer and restarted it. Now I'm seeing a the messageTop.

    Now it's working, but I find it hard to believe that restarting my computer was the solution.

  • allanallan Posts: 63,678Questions: 1Answers: 10,498 Site admin
    Answer ✓

    Sounds like a cache issue. The browser probably had an old version cached and restarting the machine cleared the cache.

    Allan

  • meet2amitsinhameet2amitsinha Posts: 1Questions: 0Answers: 0

    Hi
    your code is ok please check your jquery and related .js file version like

    https://code.jquery.com/jquery-3.3.1.js
    https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js
    https://cdn.datatables.net/buttons/1.5.2/js/dataTables.buttons.min.js
    https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js
    https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js
    https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js
    https://cdn.datatables.net/buttons/1.5.2/js/buttons.html5.min.js
    https://cdn.datatables.net/buttons/1.5.2/js/buttons.print.min.js
    

    Use same version its working properly.

This discussion has been closed.