Documentation for cell().data() is wrong.

Documentation for cell().data() is wrong.

pgorbaspgorbas Posts: 13Questions: 3Answers: 0

I am referring to page :

The page states at the top "Since: DataTables 1.10" And the value I get when I run $.fn.dataTable.version is "1.10.8".

The documentation says this, sample code 1 on the page, will work, but when I run it ( only replacing the Table's parents Div id from '#example tbody' to '<MyTableId> tbody' the resulting value in the alert is "Undefined"

var table = $('#example').DataTable();
$('#example tbody').on( 'click', 'td', function () {
    alert( table.cell( this ).data() );
} );

Indeed when I run this line var XXX = table.cell(this).data();, the value of XXX is also "Undefined". The cell I clicked on displays the value "9999999999"


  • pgorbaspgorbas Posts: 13Questions: 3Answers: 0

    If I try to SET the data per example 2 code

        var cell = table.cell( this ); "FUBAR" ).draw();//changed data from " + 1" to "FUBAR"

    The DataTable code throws an exception:

    And a step deeper:

  • kthorngrenkthorngren Posts: 7,000Questions: 22Answers: 1,525

    I tried your examples here and it seems to work:

    I even tried with 1.10.8 in the test case.

    Maybe its something with your Angular environment causing a problem with this. Sorry, I'm not familiar with Angular.


  • colincolin Posts: 6,884Questions: 0Answers: 1,176

    As Kevin's example shows, it's behaving there. It would be worth updating to the most recent version, 1.10.18 (1.10.19 is the same!) - and seeing if that helps. If not, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.



Sign In or Register to comment.