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!

4
  • Does it work if you do it in JavaScript? Are you using TurboLinks? Commented Jul 9, 2014 at 22:57
  • Yes, I'm using TurboLinks. Is it as simple as mixing in regular Javascript into the CoffeeScript file? Commented Jul 10, 2014 at 1:56
  • I suspect that this is a duplicate of the question in disguise: stackoverflow.com/q/18769109/479863 Commented Jul 10, 2014 at 4: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: stackoverflow.com/questions/24704610/… Commented Jul 11, 2014 at 18:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.