How to get row expand click event to avoid row click.

How to get row expand click event to avoid row click.

ppawarppawar Posts: 2Questions: 1Answers: 0

I have table with clickable row, i'm show details at bottom of table when i click on row. but when i click on expand row image then it conflict row expand button with row click.. . I do not want to fire row click event when i click on row expand button

Answers

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    Without seeing what you have and what you are trying to do it will be hard to offer suggestions. Please post a link to your page or a test case replicating the problem so we can help.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • ppawarppawar Posts: 2Questions: 1Answers: 0

    I have below click event on table, which gets fire on table row click. But below event also gets fire when i click on green + and - sign (Expand/Collapse Button) . I want to avoid/by pass below event to get fired when i will click on green + and - sign (Expand/Collapse Button).

    Event i 'm having in code:-

    $('#datatable-buttons tbody').on('click', 'tr', function (e) {

        e.preventDefault();
        var Name = $(event.target).attr('class');
        var SelectedClass = "policyClick";
    
        var row = $(this);                 //cache the row
        if (!row.hasClass('selected')) {
            row.addClass('selected')       //add class to clicked row
                .siblings()                //get the other rows
                .removeClass('selected');  //remove their classes
        }
    
  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    Maybe you need to use the :not() selector. See if this works:

    $('#datatable-buttons tbody').on('click', 'tr:not(.details-control)', function (e) {

    Assuming you are using this example.

    Kevin

This discussion has been closed.