How to access fnSettings() and _('tr') when using non id selector e.g: $('table').dataTable()

How to access fnSettings() and _('tr') when using non id selector e.g: $('table').dataTable()

daniel_rdaniel_r Posts: 460Questions: 4Answers: 67
edited July 2013 in General
Suppose I got 2 tables without ids that I want to apply the .dataTable() to with the following selector:

$('table').dataTable().myplugin();//affects two tables

I wonder how can I access the fnSettings() and _('tr') of the first and second table inside my plugin, because the this._('tr') shows me the rows of the first table only and this[0]._('tr') and this[1]._('tr') are undefined.

Regards,

Daniel.

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    You can use iApiIndex ( http://datatables.net/development/ ) to get the second table, or something like:

    [code]
    $('table').eq(1).dataTable().myplugin();
    [/code]

    Proper multi table support is built into the 1.10 API (for when it is released).

    Allan
  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67
    Thanks, iApiIndex was what I needed...
This discussion has been closed.