Add footerCallback after table initialisation (code breaks after minification)

Add footerCallback after table initialisation (code breaks after minification)

StefanRStefanR Posts: 12Questions: 2Answers: 2

Is it possible to add a footerCallback to an existing table? If so please could you post an example?

Background: I'm having a really hard time with a particular piece of code that sums up the values in a table column; this code breaks when I use uglifier to minimise and compress the code in a Rails app.

Specifically in my environment.rb file
config.assets.compress = true // this specific code in footerCallback stop working
config.assets.compress = false // all JS code works fine

I've dug into uglifier's config but wasn't able to work out what causes the issue. Uglifier does not affect any other part of my code, just this piece.

Long story short, I'd like to see if I can 'attach' the uncompressed footerCallback after everything is loaded (all the compressed JS).

I realise this is a workaround and I will dig deeper but would love to explore this angle just to prove it works. Well I kind of proved it already as I excluded the JS code that contains the table initialisation and footerCallback code from th eRaisl assets pipeline and voilà, it all works ok...

Thanks.

Replies

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

    Hi @StefanR ,

    This example here creates a footer, and that's done at table initialisation. I took that code and shoved it into an event handler, so now outside of the table initialisation, and it's doing the same.

    I hope that does what you were looking for,

    Cheers,

    Colin

  • StefanRStefanR Posts: 12Questions: 2Answers: 2

    Thank you very much, I'll give that a try!

This discussion has been closed.