0

Using the famous dataTables plugin, Every time that i draw rows to the table to be displayed, rowCallback adds a click handler to the row and as a result the event fires multi-times. How can some one avoid this behaviour ?

My Callback

        rowCallback: function( row, data, index ) {
            $(row).on("click", function(){
                callMyMethod();
            });

            $(row).on("dblclick", function(){
            });
        }, 
2
  • How are you binding the click handler right now? Commented Nov 10, 2017 at 15:35
  • i just added in original message my Callback Commented Nov 10, 2017 at 15:47

1 Answer 1

1

Try to update the event handlers like:

$(row).off("click").on("click", function() {
  console.count('Clicked');
});

$(row).off("dblclick").on("dblclick", function() {
  console.count('Double Clicked');
});
Sign up to request clarification or add additional context in comments.

Comments

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.