Click event unbinded after .fnAdjustColumnSizing(true) method

Click event unbinded after .fnAdjustColumnSizing(true) method

macusermacuser Posts: 20Questions: 0Answers: 0
edited May 2012 in Bug reports
Hey,

I tried to bind a click event to an input checkbox tag in a table row and called the fnAdjustColumnSizing to adjust the column width.
But after the method call, the click event which was bound to the input element was not found.

Regards.

Replies

  • macusermacuser Posts: 20Questions: 0Answers: 0
    This was observed in DT 1.8.2
  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    Can you give us a link please?

    Allan
  • macusermacuser Posts: 20Questions: 0Answers: 0
    Hi Allan,

    I could replicate the issue. This scenario occurs with use of fixed column.

    http://live.datatables.net/emuzez

    Steps to replicate:
    1. Clicking on check boxes will generate random number after the header.
    (This shows check boxes are bound with a function)
    2. Click on the button below the header.
    (This calls the fnAdjustColumnSizing function)
    3. Now try to click on the check boxes

    The click events are unbound. I think the issue is when you clone the first columns, it doesnt clone the function bound with the input tags.

    Thanks :)
  • macusermacuser Posts: 20Questions: 0Answers: 0
    This happens also when sorting is performed in a DT with fixed column.

    Hope you have a quick fix for this issue :)
  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    Using a live event addresses the issue: http://live.datatables.net/emuzez/2/edit . The problem is that with FixedColumns enabled, the elements are being cloned, and thus the events dropped, since the old elements are the ones with the events attached to them.

    Allan
  • macusermacuser Posts: 20Questions: 0Answers: 0
    Thanks Allan for your promot reply.

    Appreciate it :)
  • fearednerdfearednerd Posts: 44Questions: 0Answers: 0
    I noticed that the checked rows becomes unchecked after you sort. I realize that the elements are being cloned thus the reason of there being no more checks. Is there a way around this to keep the checks in place?
This discussion has been closed.