"dt-button-collection" trigger event on hide

"dt-button-collection" trigger event on hide

itajackassitajackass Posts: 53Questions: 21Answers: 3

Is there an event to trigger when it hide?
I need this to redraw tables cause sometimes appear scrolling and header goes no aligned.

Something like this?

$(document).on("hide", ".dt-button-collection", function(event) {
setTimeout(function(){
$.fn.dataTable.tables( {visible: true, api: true} ).columns.adjust().responsive.recalc().draw();
}, 1000);
});

but this doesn't work..

Replies

  • colincolin Posts: 1,741Questions: 0Answers: 321

    Hi @itajackass ,

    When you say, "when it hide", do you mean the button collection? I'm surprised that when the collection is closed it affects the scrolling and header alignment. You could try the autoClose option as in this example - that may make a difference.

    I've played around with events and can't get one to trigger when the collection closes, but perhaps you could trigger on the thing that the button does?

    Cheers,

    Colin

  • itajackassitajackass Posts: 53Questions: 21Answers: 3
    edited June 14

    Yes see attachment. It occurs when i've only few row but a lot of columns so dropdown is height and scroller appear inside datatable
    Ok i'll try thanks

  • colincolin Posts: 1,741Questions: 0Answers: 321

    That is odd. I tried to reproduce it with a table from a different thread without any joy (see here). If you could link to a test page. or modify my example, then we could take a look.

    Cheers,

    Colin

  • itajackassitajackass Posts: 53Questions: 21Answers: 3
  • allanallan Posts: 47,517Questions: 1Answers: 6,755 Site admin

    Its because the drop down menu is inside the tab container. The tab container must have a fixed or max-height on it, so it isn't automatically resizing (height-wise) to accommodate the drop down.

    I'd suggest using the collectionLayout option of the collection button type, set to be two-column to address that (i.e. less height).

    Allan

Sign In or Register to comment.