Finding Table ID from Row

Finding Table ID from Row

DalderDalder Posts: 30Questions: 12Answers: 1

Hello there.

I've got two DataTables on the same page. I am feeding data into the page via WebSockets at which point it could be inserted into either table depending on a status in the data.

There is a need for me to check what table a row is part of in case I need to swap it from one to another if the status changes.

I've tried using the jQuery table-selector method tables.table($("tr[id='268']").parents('table')) but it doesn't seem to work.

Running tables.table($("tr[id='268']").parents('table')).rows() gives me back information about the individual row so I know that the jQuery table-selecor is working.

What am I missing?

Thanks in advance.

Dan

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947
    Answer ✓

    Not sure but maybe something like this would work:

    $("tr[id='268']").parents('table').attr('id)
    

    Kevin

  • DalderDalder Posts: 30Questions: 12Answers: 1

    Hi Kevin,

    Thanks for the help.

    I was hoping to keep it all within the confines of DataTables, but that's just me being pedantic!

    Dan

This discussion has been closed.