FixedHeader column click

FixedHeader column click

zx81zx81 Posts: 9Questions: 2Answers: 0

Example : https://jsfiddle.net/mqapoxu8/4/

Table ordering is set to false, fixedHeader to true.

I intercept the column header click with

$('.device-table').on( 'click', 'thead th', function () {
alert('x');
} );

It works fine except when the table has been scrolled. Any solution ?

Replies

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    You need to use delegated events for that, as FixedHeader adds an additional element to the DOM:

    $('.device-table thead').on( 'click', 'th', function () {
       alert('x');
    } );
    

    Updated example here,

    Colin

  • zx81zx81 Posts: 9Questions: 2Answers: 0

    Awesome. Thanks a lot Colin.

This discussion has been closed.