Tr select when clicked button in td

Tr select when clicked button in td

DisabledgDisabledg Posts: 4Questions: 2Answers: 0
edited December 2018 in Free community support

Hello!

Using DataTables with
"select": { "style": 'multi' },

When i click on button located in TD it also select current tr. How can i avoid that?

This question has an accepted answers - jump to answer

Answers

  • rf1234rf1234 Posts: 2,802Questions: 85Answers: 406
    edited December 2018 Answer ✓

    Use a selector:

    select: {
        style: 'multi',
        selector: 'td:not(:first-child)'
    },
    

    or something similar

    Here is another one. I have button and links in the rightmost two columns so they mustn't be selectable

    selector: 'td:not(:last-child, :nth-last-child(2))' // no row selection on last two columns
    
  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Hi @Disabledg ,

    You can specify the selectors to activate selects with select.selector - if you're button is in the last column, then the final example on that page will do the trick.

    Cheers,

    Colin

This discussion has been closed.