Click on a cell, get value from other columns

Click on a cell, get value from other columns

mbornmborn Posts: 44Questions: 17Answers: 0

I have a column that I am capturing the value of when I click (column 1 as shown below):

            $('#mainTable').on('click', 'tbody td', function () {
                var index = mainTable.column(this).index();

                if (index == 1) {
                    $('#whichTable').val('market');
                    var cellValue = $(this).text();           
                }

            });

How do I get the value of column zero from the same row?

Answers

  • mbornmborn Posts: 44Questions: 17Answers: 0

    Found a solution:

                        var rowindex = mainTable.row(this).index();
                        var ownertype = mainTable.cell(rowindex, 0).data();
    
                        $('#drilldown2').val('Company');
                        if (ownertype == '<u>Franchise</u>') {
                            $('#drilldown2').val('Franchise');
                        }
    
This discussion has been closed.