DataTables logo DataTables

via Ad Packs
fnGetData not returning row information
  • Hello,

    I'm trying to use fnGetData to get the values of a row that was clicked on using the technique in the documentation, but for some reason fnGetData is only returning an empty array.

    var tableId = '#table1';
    var oTable[tableId] = $(tableId).dataTable();             // Using oTable array due to multiple tables on the page
    
    oTable[tableId].$('tr').on('click', showRow);
    
    function showRow(){
    	console.log(oTable[tableId].fnGetData(this));
    }
    

    returns simply...
    [ ]
    

    ...in the console.
  • 3 Comments sorted by
  • I checked, and 'this' in the showRow function does return the row node that was clicked on.
  • Seems to work okay for me: http://live.datatables.net/uwewob/edit

    I've changed in invalid syntax of "var oTable[tableId]", but other than that - it looks fine.

    Allan
  • Well, I restructured how my app was put together (for other reasons), and it seems to be working now. Not sure what was going on, but I really appreciate you looking at it! :-)

    Thanks Allan.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Support

Get useful and friendly help straight from the source.

In this Discussion