Uncaught TypeError: Cannot set property 'swfPath' of undefined

Uncaught TypeError: Cannot set property 'swfPath' of undefined

MrKementariMrKementari Posts: 4Questions: 1Answers: 0

Hello,

I'm sorry if this question has already been asked before, I have some issues with DataTables : export buttons are not displayed with my table, and I really don't understand why...

The error message displayed is : "Uncaught TypeError: Cannot set property 'swfPath' of undefined".

I join to this post a few parts of my code.
If somebody is able to help me, it would be nice :smile:

(Sorry for my bad english, it's not my native language).

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 62,994Questions: 1Answers: 10,368 Site admin

    I don't actually see swfPath being set in any of your Javascript files. Can you show me where that line of code is please?

    My guess is that you are attempting to set the swfPath without having loaded the Buttons Flash file (buttons.flash.js).

    Allan

  • MrKementariMrKementari Posts: 4Questions: 1Answers: 0

    Hi ! Thanks for your answer.

    The swfPath var is defined in buttons.flash.min.js. I join it to the post.

    Just for information, I have modified a Bootstrap theme which uses DataTables, so I don't really master how it has been included in.

    Regards.
    Aurélien

  • allanallan Posts: 62,994Questions: 1Answers: 10,368 Site admin

    Hi Aurélien,

    Thanks for your reply. Could you create a test case on http://live.datatables.net or JSFiddle showing the issue so I can help to debug it please? Or alternatively just a link to your page showing the error would be fine.

    I don't see what is causing the issue form the above I'm afraid.

    Thanks,
    Allan

  • allanallan Posts: 62,994Questions: 1Answers: 10,368 Site admin
    Answer ✓

    Actually one thing - load the Buttons JS file before you load the Buttons Flash file.

    Allan

  • MrKementariMrKementari Posts: 4Questions: 1Answers: 0

    Hi Allan,

    thanks for your answer, I tried to load Buttons JS file before Buttons Flash file but it remains the same.

    I'm sorry I can't share more informations because most of HTML code (for example the data_newtest table) is generated with Python Flask. I can't share website URI because it's an internal company application, not accessible from the Internet.

    I'll try to figure it out anyway, thanks for your answers :smile:

    Regards.
    Aurélien

  • allanallan Posts: 62,994Questions: 1Answers: 10,368 Site admin
    Answer ✓

    As it appears to work okay on this page I really would need a test page showing the problem to be able to offer any help.

    If you find the issue, let us know what it was :)

    Allan

  • MrKementariMrKementari Posts: 4Questions: 1Answers: 0

    Okay, it's a dumb mistake, I just forgot to include dataTables.buttons.min.js file... Everything works fine now.
    Thanks for your help Allan ! ;-)

This discussion has been closed.