Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81728

syntax for clicked datatable and data by index

$
0
0

I have three datatables on a page that each have the first column having '.details-control' item. Instead of having three different onClick functions I would like to make just one. To do that, I need:

1) the onClick to know what datatable is clicked
2) I need to access the third data element for each table instead of hard-coding the field name since for each table the field name will be different.I tried data[0][3] as well as data[0,3] and even data[3]. None of these worked.

What is the syntax for each of these two items?

        $('.display tbody').on('click', '.details-control', function (e) {
            e.preventDefault(); //TODO: not working!!!!!!!!! Don't want to select/deselect when .details-control is clicked
            var data = dependencytable.row($(this).parents('tr')).data();   //don't want to hardcode the tablename
            alert(data["Dependencies"]["note"]);            //don't want to hardcode the data element name
        });

Viewing all articles
Browse latest Browse all 81728

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>