If I have a reference to the table object, how can I get the id for the table?

If I have a reference to the table object, how can I get the id for the table?

utkantutkant Posts: 8Questions: 4Answers: 0

I am using dataTables and AngularJS together so I make the table and add it to the $scope as this:

$scope.theList = $element.find('table').DataTable(config);

This is working ok, but now when I want the datatable Id I am not sure how to retrieve it using the datatable object in the $scope.theList variable.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    You can use the table().node() method to get the table's node - i.e:

    var id = $scope.theList.table().node().id;
    

    Allan

  • utkantutkant Posts: 8Questions: 4Answers: 0

    Thank you very much :)

This discussion has been closed.