Using SELECT and RESPONSIVE extension together - Problem with the click event

Using SELECT and RESPONSIVE extension together - Problem with the click event

poetawdpoetawd Posts: 12Questions: 1Answers: 0

Hello All !

I am using SELECT and RESPONSIVE extension together in the same table.

The user will be redirected when it clicks on a table row....

grid.on('select', function (e, dt, type, indexes) {

        var rowData = grid.rows(indexes).data().toArray();
        //console.log('rowData');

        //console.log(rowData);

        var id = rowData[0][0];
        //console.log(id);

        onChange(id);
 });

The problem is that when I have the RESPONSIVE extension on....

When the user clicks on the "+" icon, to show the row details, it triggers the above "on select" event...

Is there a way to stop that behavior ? Like, if the user clicks on the "+" button the "on select" event is not triggered ... Or someway to check, inside the "on select" function that will stop that function...

Thanks in advance !

Answers

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

    Hi @poetawd ,

    You can use select.selector to prevent row selection on specific rows. So if you want to avoid the first responsive column, you'd do something like

    selector: 'td:not(:first-child)'
    

    Cheers,

    Colin

  • poetawdpoetawd Posts: 12Questions: 1Answers: 0
    edited October 2018

    Awesome ! It kind of works....

    But, is that a way to activate that behavior only if the table gets colapsed ?

    I tryed this but it did´nt work....

    select: {
                style: 'os',
                selector: 'table.colapsed td:not(:first-child)'
            },
    
    
  • allanallan Posts: 63,457Questions: 1Answers: 10,466 Site admin

    Yes, use a control column. It is hidden if the table isn't collapsed, but shown if it is.

    Allan

  • poetawdpoetawd Posts: 12Questions: 1Answers: 0

    AWESOME !!!

    Many Thanks for the help !!!!

    B)

This discussion has been closed.