"dt-button-collection" trigger event on hide

"dt-button-collection" trigger event on hide

itajackassitajackass Posts: 121Questions: 37Answers: 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: 15,143Questions: 1Answers: 2,586

    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: 121Questions: 37Answers: 3
    edited June 2018

    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: 15,143Questions: 1Answers: 2,586

    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: 121Questions: 37Answers: 3
  • allanallan Posts: 61,700Questions: 1Answers: 10,102 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

  • GurupriyanGurupriyan Posts: 15Questions: 6Answers: 0

    @allan & @colin , I too need "dt-button-collection" hide/close event. kindly help me ASAP

  • allanallan Posts: 61,700Questions: 1Answers: 10,102 Site admin

    This is where an event would need to be added. Daft question, but why do you need to know that?

    Allan

  • GurupriyanGurupriyan Posts: 15Questions: 6Answers: 0

    Thanks @allan . I need that to track user's activity along with collections

This discussion has been closed.