0

I apparently have no CoffeeScript-fu.

I've got a Rails 4.1 app with jquery-datatables-rails and everything works perfectly.

However, I would like to hide a class any time the datatable is ordered OR searched (I'd be happy if I could figure out one or the other.) I'm not having much luck making this happen. I cannot figure out how to capture events from the datatable.

I see a great example in plain Javascript here, but can't make it happen in CoffeeScript.

Can someone give me a kick in the right direction?

Here's my existing CoffeeScript, which disables the initial sort and disallows sorting on certain columns (which is what I want.)

jQuery ->
    $('#customers').dataTable(
        "sPaginationType": "bootstrap"
        "aaSorting": []
        "aoColumnDefs": [{
            "bSortable": false,
            "aTargets": ['nosort']
        }]
    )

Thank you in advance!

mu is too short
  • 396,305
  • 64
  • 779
  • 743
Rob E.
  • 129
  • 1
  • 12
  • Does it work if you do it in JavaScript? Are you using TurboLinks? – mu is too short Jul 09 '14 at 22:57
  • Yes, I'm using TurboLinks. Is it as simple as mixing in regular Javascript into the CoffeeScript file? – Rob E. Jul 10 '14 at 01:56
  • I suspect that this is a duplicate of the question in disguise: http://stackoverflow.com/q/18769109/479863 – mu is too short Jul 10 '14 at 04:51
  • @muistooshort: Thank you very much for your help. The link you provided definitely got me on the right track. I've simplified things in jQuery but I'm still having trouble attaching the event handlers using CoffeeScript. I posted a follow-up question here: http://stackoverflow.com/questions/24704610/translating-jquery-to-coffeescript – Rob E. Jul 11 '14 at 18:56

0 Answers0