Datatables responsive loses click events in table row and bootstrap dropdrown issue

Datatables responsive loses click events in table row and bootstrap dropdrown issue

jsonjurijsonjuri Posts: 1Questions: 1Answers: 0
edited February 2015 in Free community support

When i resize the datatable to responsive mode all click events does not work anymore.
Also i am using a bootstrap dropdown inside my table row and it expands automatically when the datatable shows in responsive mode.

I am using the following to load the click events all working fine, but not in responsive mode.

fnDrawCallback: function(oSettings) {
$('.item').off('click').on('click', function(e) { function... });
}

Someone know how i can fix this?

Answers

  • allanallan Posts: 61,635Questions: 1Answers: 10,092 Site admin

    Can you link to a test case showing the issue, as required in the forum rules.

    Thanks,
    Allan

  • dsnapdsnap Posts: 23Questions: 3Answers: 0
    edited February 2015

    Hey Allan,
    I've got the same/similar problem.
    Built this real quick, http://live.datatables.net/jipisazu/1/edit?html,output

  • allanallan Posts: 61,635Questions: 1Answers: 10,092 Site admin

    So the problem there is the same as the top FAQ. Basically a static event handler has been used, so it won't be applied to any new elements.

    The way Responsive works is to take a copy of the information to be displayed. It might be possible ultimately to use the original DOM elements from the cell, but when I've tried that in the past it prove to be surprisingly complex.

    So for now you would need to know that it is clone of the original data and use a delegated event handler. I realise that this will make things more complex for such a table - apologies.

    Allan

  • dsnapdsnap Posts: 23Questions: 3Answers: 0

    That's what I thought was going on. I was hoping there was a secret responsiveCalculationComplete event I could ride the coattail of.

  • allanallan Posts: 61,635Questions: 1Answers: 10,092 Site admin

    You could possibly use column-visibility which is triggered when Response shows or hides a column.

    Allan

This discussion has been closed.