Detect click on specific column

Detect click on specific column

Igorski88Igorski88 Posts: 25Questions: 8Answers: 0

oI am doing a favorets flag column and when a click is detected I would like the Row to be saved as a faverited Item. I am using a solid star for the "favorited" row. When I click on the star I want to Un -avorite the row. Currently,

I am using the following:

       $('#ResultsTable tbody').on('click', 'tr td:eq(0)', function () {
        var table = $('#ResultsTable').DataTable();                     
        MarkItemsAsFavorite(table.row(this).id());
    });

The problem: This only works on the first Row.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,950
    Answer ✓

    I think the problem is you jQuery selector of td:eq(0) only applies to the first cell in the table. You will want something like td:first-child to get the first cell of each row.

    Kevin

  • Igorski88Igorski88 Posts: 25Questions: 8Answers: 0

    How did I overlook that!! Thanks for your help

This discussion has been closed.