this.s.subButtons[c].push error when trying to create a table with three Buttons on Safari

this.s.subButtons[c].push error when trying to create a table with three Buttons on Safari

chiloutuschiloutus Posts: 10Questions: 4Answers: 0

Hi,

This is a strange issue I am experiencing with how the buttons extension interacts with the table. I initially thought it was something specific to our own codebase but I have managed to replicate it in a JsFiddle. Link: http://jsfiddle.net/ppqyjk4d/

It seems that when trying to create the buttons "]" is calculated as 2 (I think this is the number of buttons created) in Safari, but correctly calculated as 3 in Chrome. This reference to an array position that doesn't exist then crashes with the mentioned error.

Traceback is:

[Error] TypeError: undefined is not an object (evaluating 'this.s.subButtons[c].push')
_buildButtons (datatables.min.js, line 206)
_buildButtons (datatables.min.js, line 205)
_buildButtons (datatables.min.js, line 206)
_constructor (datatables.min.js, line 204)
l (datatables.min.js, line 199)
fnInit (datatables.min.js, line 228)
nb (datatables.min.js, line 59)
ia (datatables.min.js, line 75)
(anonymous function) (datatables.min.js, line 122)
each (jquery-1.8.3.js, line 611)
each (jquery-1.8.3.js, line 241)
m (datatables.min.js, line 112)
DataTable (datatables.min.js, line 191)
(anonymous function) (show, line 83)
fire (jquery-1.8.3.js, line 974)
add (jquery-1.8.3.js, line 1020)
ready (jquery-1.8.3.js, line 246)
(anonymous function) (show, line 53)
dispatch (jquery-1.8.3.js, line 3058)
eventHandle (jquery-1.8.3.js, line 2676)

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 63,173Questions: 1Answers: 10,409 Site admin
    Answer ✓

    I think this is a bug in the 2.0.0 release of Buttons. Could you try using the nightly version please. Unfortunately the fix isn't available in the download builder yet, but will be soon - probably next week.

    Allan

  • chiloutuschiloutus Posts: 10Questions: 4Answers: 0

    Hi Allan,

    I actually came across a thread regarding the fix and have implemented the nightly build. Which works a treat, thanks for that. However there still seems to be an issue with the collection buttons in Safari, it seems that the columns are not properly wrapping in safari.

    I updated the JSfiddle to show you what I mean.

    http://jsfiddle.net/2evsvybe/1/

  • allanallan Posts: 63,173Questions: 1Answers: 10,409 Site admin
    Answer ✓

    Interestingly it is exactly the same bug in the browser as this one I reported to Chrome. You need to remove the border-radius on the a.dt-button tags to have it display correctly in the browser.

    I guess the bug comes from before the Webkit / Blink fork.

    I've just tried it with the Wekbit nightly for OSX (r195574) and it appears to work as expected - the labels are shown. So I would expect the next version of Safari will include the fix. Until then the workaround noted above is the only option really.

    Allan

  • chiloutuschiloutus Posts: 10Questions: 4Answers: 0

    Interesting. I will implement the workaround for now. Thanks for your help!

  • musinikmusinik Posts: 22Questions: 5Answers: 1
    edited January 2016

    Had the same problem in Safari (5.1.4 Win10). Used colVis.
    This helped!
    Thanks allan!!!

This discussion has been closed.